1 | <?php |
||
7 | class BranchValidator implements BranchValidatorInterface |
||
8 | { |
||
9 | /** @var HtmlElementInterface */ |
||
10 | private $htmlElement; |
||
11 | |||
12 | /** @var array The options to check to valid a branch */ |
||
13 | private $checks = array('parent', 'extends', 'children'); |
||
14 | |||
15 | public function __construct(HtmlElementInterface $htmlElement) |
||
19 | |||
20 | /** |
||
21 | * Valid the current map branch. |
||
22 | * |
||
23 | * @param string $name The current element name |
||
24 | * @param array $circular The array of elements names called in the current branch of map |
||
25 | */ |
||
26 | public function validateBranch($name, array $circular = array()) |
||
47 | |||
48 | /** |
||
49 | * Validate the current element class. |
||
50 | * |
||
51 | * @param array $current The current element |
||
52 | * |
||
53 | * @throws InvalidElementException If the current element defines a class which doesn't exist |
||
54 | */ |
||
55 | private function validateClass(array $current) |
||
64 | |||
65 | /** |
||
66 | * Validate himself references. |
||
67 | * |
||
68 | * @param string $name The current element name |
||
69 | * @param array $currentCheck The current check context |
||
70 | * @param string $check The current check name |
||
71 | * |
||
72 | * @throws InvalidElementException If the current element defines himself as parent, children or extends |
||
73 | */ |
||
74 | private function validateDefineHimself($name, array $currentCheck, $check) |
||
84 | |||
85 | /** |
||
86 | * Validate circular references. |
||
87 | * |
||
88 | * @param string $name The current element name |
||
89 | * @param string|array $currentCheck The current check context |
||
90 | * @param string $check The current check name |
||
91 | * @param array $circular The names of the previous elements called |
||
92 | * |
||
93 | * @throws InvalidElementException If the current element defines a parent, child or extends which creates circular |
||
94 | * reference |
||
95 | */ |
||
96 | private function validateCircularReferences($name, $currentCheck, $check, array $circular) |
||
110 | } |
||
111 |