1 | <?php |
||
23 | class BlockDirective extends Directive implements DirectiveInterface |
||
24 | { |
||
25 | /** @var array orderd list of sub directives */ |
||
26 | private $directives = []; |
||
27 | |||
28 | /** |
||
29 | * Adds a Directive at the end of the list. |
||
30 | * |
||
31 | * @param DirectiveInterface $directive a directive to add |
||
32 | */ |
||
33 | 9 | public function add(DirectiveInterface $directive) |
|
39 | |||
40 | /** |
||
41 | * Confirms if the directive contains a specified directive. |
||
42 | * |
||
43 | * @param string $name the directive for which to check existence |
||
44 | * |
||
45 | * @return bool true if the sub-directive exists, false otherwise |
||
46 | */ |
||
47 | 1 | public function hasDirective($name) |
|
61 | |||
62 | /** |
||
63 | * Looks into sub directives to confirm if the actual contains a specified directive. |
||
64 | * |
||
65 | * @param string $name the directive for which to check existence |
||
66 | * @param bool $inSubDirective the actual state |
||
67 | * @param DirectiveInterface $directive the sub directive to look into |
||
68 | * |
||
69 | * @return bool true if the sub-directive exists, false otherwise |
||
70 | */ |
||
71 | 1 | private function hasInnerDirective($name, $inSubDirective, DirectiveInterface $directive) |
|
79 | |||
80 | /** |
||
81 | * Confirms if the directive is simple. |
||
82 | * |
||
83 | * Block directive can have sub directives |
||
84 | * |
||
85 | * @return bool true if the directive is simple, false otherwise |
||
86 | */ |
||
87 | 1 | public function isSimple() |
|
91 | |||
92 | /** |
||
93 | * Dumps the directive respecting a server syntax. |
||
94 | * |
||
95 | * @param ServerInterface $server a server instance |
||
96 | * @param int $spaces the indentation spaces |
||
97 | * |
||
98 | * @return string the dumped directive |
||
99 | */ |
||
100 | 1 | public function dump(ServerInterface $server, $spaces = 0) |
|
112 | |||
113 | /** |
||
114 | * Dumps a starting/ending block directive. |
||
115 | * |
||
116 | * @param string $directiveString the start/end directive string |
||
117 | * @param int $spaces the indentation spaces |
||
118 | * |
||
119 | * @return string the dumped directive |
||
120 | */ |
||
121 | 1 | private function dumpBlock($directiveString, $spaces = 0) |
|
136 | |||
137 | /** |
||
138 | * Confirms if a Block directive is a 'main' context. |
||
139 | * |
||
140 | * @return bool true if the name of the block directive is 'main', false otherwise |
||
141 | */ |
||
142 | 1 | private function isMainContext() |
|
146 | } |
||
147 |