1 | <?php |
||
15 | class Node |
||
16 | { |
||
17 | /** @var string Selector for node */ |
||
18 | public $selector; |
||
19 | /** @var string HTML tag name */ |
||
20 | public $tag; |
||
21 | /** @var $this Pointer to parent node */ |
||
22 | public $parent; |
||
23 | /** @var self[] Collection of nested nodes */ |
||
24 | public $children = array(); |
||
25 | |||
26 | /** |
||
27 | * Create LESS Node. |
||
28 | * |
||
29 | * @param string $selector Forced LESS node selector |
||
30 | * @param string $tag HTML tag name |
||
31 | * @param self $parent Pointer to parent node |
||
32 | */ |
||
33 | 2 | public function __construct($selector, $tag, self &$parent = null) |
|
46 | |||
47 | /** |
||
48 | * Get child node by selector. |
||
49 | * |
||
50 | * @param string $selector Node selector |
||
51 | * |
||
52 | * @return null|$this Node or null if not found |
||
53 | */ |
||
54 | 2 | public function getChild($selector) |
|
62 | |||
63 | /** |
||
64 | * @return string Object string representation |
||
65 | */ |
||
66 | 2 | public function __toString() |
|
70 | } |
||
71 |