1 | <?php |
||
7 | class BranchValidator implements BranchValidatorInterface |
||
8 | { |
||
9 | /** @var HtmlElementInterface */ |
||
10 | private $htmlElement; |
||
11 | |||
12 | /** |
||
13 | * @var array The options to check to valid a branch. The bool determine if the option can |
||
14 | * define more than one value. True = unique value, False = multiple values |
||
15 | */ |
||
16 | private $checks = array( |
||
17 | 'parent' => true, |
||
18 | 'extends' => false, |
||
19 | 'children' => false |
||
20 | ); |
||
21 | |||
22 | public function __construct(HtmlElementInterface $htmlElement) |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | public function validateBranch($name, array $circular = array()) |
||
54 | |||
55 | /** |
||
56 | * Validate the current element class. |
||
57 | * |
||
58 | * @param array $current The current element |
||
59 | * |
||
60 | * @throws InvalidElementException If the current element defines a class which doesn't exist |
||
61 | */ |
||
62 | private function validateClass(array $current) |
||
71 | |||
72 | /** |
||
73 | * Validate himself references. |
||
74 | * |
||
75 | * @param string $name The current element name |
||
76 | * @param array $currentCheck The current check context |
||
77 | * @param string $check The current check name |
||
78 | * |
||
79 | * @throws InvalidElementException If the current element defines himself as parent, children or extends |
||
80 | */ |
||
81 | private function validateDefineHimself(string $name, $currentCheck, string $check) |
||
91 | |||
92 | /** |
||
93 | * Validate circular references. |
||
94 | * |
||
95 | * @param string $name The current element name |
||
96 | * @param string|array $currentCheck The current check context |
||
97 | * @param string $check The current check name |
||
98 | * @param array $circular The names of the previous elements called |
||
99 | * |
||
100 | * @throws InvalidElementException If the current element defines a parent, child or extends which creates circular |
||
101 | * reference |
||
102 | */ |
||
103 | private function validateCircularReferences(string $name, $currentCheck, string $check, array $circular) |
||
117 | } |
||
118 |