1 | <?php |
||
12 | class Children |
||
13 | { |
||
14 | /** |
||
15 | * @var array $allowedTypes |
||
16 | */ |
||
17 | private $allowedTypes = [ |
||
18 | Node::class, |
||
19 | Closure::class, |
||
20 | 'array' |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * @var Node $node |
||
25 | */ |
||
26 | private $node; |
||
27 | |||
28 | /** |
||
29 | * Children constructor. |
||
30 | * |
||
31 | * @param Node $node |
||
32 | */ |
||
33 | 10 | public function __construct(Node $node) |
|
37 | |||
38 | /** |
||
39 | * @param Node $node |
||
40 | * @param array $children |
||
41 | * @return mixed |
||
42 | */ |
||
43 | 10 | public static function run(Node $node, array $children) |
|
47 | |||
48 | /** |
||
49 | * @param array $children |
||
50 | */ |
||
51 | 10 | private function loop(array $children) |
|
60 | |||
61 | /** |
||
62 | * @param Node|array $node |
||
63 | * @return $this |
||
64 | */ |
||
65 | 9 | private function child($node) |
|
70 | |||
71 | /** |
||
72 | * @param mixed $type |
||
73 | * @return string |
||
74 | */ |
||
75 | 10 | private function realType($type) |
|
80 | |||
81 | /** |
||
82 | * @param $type |
||
83 | * @throws \Exception |
||
84 | */ |
||
85 | 10 | private function checkType($type) |
|
91 | } |
||
92 |