43 lines
762 B
PHP
Raw Normal View History

2018-09-21 15:48:23 +02:00
<?php
namespace Infinito\Attribut;
2018-09-21 15:48:23 +02:00
use Infinito\DBAL\Types\Meta\Right\LayerType;
use Infinito\Exception\NoValidChoiceException;
2019-01-16 21:47:41 +01:00
2018-09-21 15:48:23 +02:00
/**
* @author kevinfrantz
2019-01-27 18:38:21 +01:00
*
* @see LayerAttributInterface
2018-09-21 15:48:23 +02:00
*/
trait LayerAttribut
{
/**
2019-01-16 21:47:41 +01:00
* @see LayerType
*
2018-09-21 15:48:23 +02:00
* @var string
*/
protected $layer;
2019-01-16 21:47:41 +01:00
/**
* @param string $layer
*
* @throws NoValidChoiceException
*/
2018-09-21 15:48:23 +02:00
public function setLayer(string $layer): void
{
if (!in_array($layer, LayerType::getValues())) {
2019-01-27 18:38:21 +01:00
throw new NoValidChoiceException("'$layer' is not a correct layer type.");
2019-01-16 21:47:41 +01:00
}
2018-09-21 15:48:23 +02:00
$this->layer = $layer;
}
2019-01-16 21:47:41 +01:00
/**
* @return string
*/
2018-09-21 15:48:23 +02:00
public function getLayer(): string
{
return $this->layer;
}
}