| 1 | <?php |
||
| 11 | trait AstDirectivesTrait |
||
| 12 | { |
||
| 13 | |||
| 14 | /** @var Directive[] */ |
||
| 15 | protected $directives; |
||
| 16 | |||
| 17 | private $directivesCache = null; |
||
| 18 | |||
| 19 | |||
| 20 | public function hasDirectives() |
||
| 24 | |||
| 25 | public function hasDirective($name) |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param $name |
||
| 32 | * |
||
| 33 | * @return null|Directive |
||
| 34 | */ |
||
| 35 | public function getDirective($name) |
||
| 36 | { |
||
| 37 | $directive = null; |
||
| 38 | if (isset($this->directives[$name])) { |
||
| 39 | $directive = $this->directives[$name]; |
||
| 40 | } |
||
| 41 | |||
| 42 | return $directive; |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return Directive[] |
||
| 47 | */ |
||
| 48 | public function getDirectives() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param $directives Directive[] |
||
| 55 | */ |
||
| 56 | 100 | public function setDirectives(array $directives) |
|
| 57 | { |
||
| 58 | 100 | $this->directives = []; |
|
| 59 | 100 | $this->directivesCache = null; |
|
| 60 | |||
| 61 | 100 | foreach ($directives as $directive) { |
|
| 62 | $this->addDirective($directive); |
||
| 63 | 100 | } |
|
| 64 | 100 | } |
|
| 65 | |||
| 66 | public function addDirective(Directive $directive) |
||
| 70 | } |
||
| 71 |