1 | <?php |
||
13 | class Element implements VisitableInterface, AssignableInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $name; |
||
19 | /** |
||
20 | * @var Attribute[] |
||
21 | */ |
||
22 | private $attributes = []; |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $value; |
||
27 | |||
28 | /** |
||
29 | * Element constructor. |
||
30 | * |
||
31 | * @param string $name |
||
32 | * @param string|null $value |
||
33 | */ |
||
34 | 13 | public function __construct(string $name, string $value = null) |
|
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | 12 | final public function getValue(): string |
|
49 | |||
50 | /** |
||
51 | * @return bool |
||
52 | */ |
||
53 | 13 | final public function hasValue(): bool |
|
57 | |||
58 | /** |
||
59 | * @param string $value |
||
60 | */ |
||
61 | 13 | final public function setValue(string $value) |
|
68 | |||
69 | /** |
||
70 | * @param Attribute $attribute |
||
71 | */ |
||
72 | 11 | final public function setAttribute(Attribute $attribute) |
|
76 | |||
77 | /** |
||
78 | * @param Attribute[] $attributes |
||
79 | */ |
||
80 | final public function setAttributes(array $attributes) |
||
87 | |||
88 | /** |
||
89 | * @return Attribute[] |
||
90 | */ |
||
91 | 13 | final public function getAttributes(): array |
|
95 | |||
96 | /** |
||
97 | * @return bool |
||
98 | */ |
||
99 | 3 | final public function hasAttributes(): bool |
|
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | */ |
||
107 | 13 | final public function getName(): string |
|
111 | |||
112 | /** |
||
113 | * @param VisitorInterface $visitor |
||
114 | */ |
||
115 | public function accept(VisitorInterface $visitor) |
||
119 | } |