1 | <?php |
||
24 | class NodeElement |
||
25 | { |
||
26 | /** |
||
27 | * Name of the DOM element. |
||
28 | * Available tags: a, aside, b, blockquote, br, code, em, |
||
29 | * figcaption, figure, h3, h4, hr, i, |
||
30 | * iframe, img, li, ol, p, pre, s, strong, |
||
31 | * u, ul, video. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | private $tag; |
||
36 | |||
37 | /** |
||
38 | * Attributes of the DOM element. |
||
39 | * Key of object represents name of attribute, value represents value of attribute. |
||
40 | * Available attributes: href, src. |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | private $attrs; |
||
45 | |||
46 | /** |
||
47 | * List of child nodes for the DOM element. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | private $children; |
||
52 | |||
53 | public function __construct(string $tag, array $attrs = [], array $children = []) |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getTag(): string |
||
67 | |||
68 | /** |
||
69 | * @return array |
||
70 | */ |
||
71 | public function getAttrs(): array |
||
75 | |||
76 | /** |
||
77 | * @return array |
||
78 | */ |
||
79 | public function getChildren(): array |
||
83 | |||
84 | public function toArray() |
||
92 | } |
||
93 |