1 | <?php |
||
13 | class Element implements ElementVisitableInterface, AssignableInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $name; |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $value; |
||
23 | /** |
||
24 | * @var Attribute[] |
||
25 | */ |
||
26 | private $attributes = []; |
||
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) |
|
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | 13 | final public function getName(): string |
|
50 | |||
51 | /** |
||
52 | * @return bool |
||
53 | */ |
||
54 | 13 | final public function hasValue(): bool |
|
58 | |||
59 | /** |
||
60 | * @param string $value |
||
61 | */ |
||
62 | 13 | final public function setValue(string $value) |
|
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | 12 | final public function getValue(): string |
|
77 | |||
78 | /** |
||
79 | * @param Attribute $attribute |
||
80 | */ |
||
81 | 11 | final public function setAttribute(Attribute $attribute) |
|
85 | |||
86 | /** |
||
87 | * @return bool |
||
88 | */ |
||
89 | 3 | final public function hasAttributes(): bool |
|
93 | |||
94 | /** |
||
95 | * @return Attribute[] |
||
96 | */ |
||
97 | 13 | final public function getAttributes(): array |
|
101 | |||
102 | /** |
||
103 | * @param ElementVisitorInterface $visitor |
||
104 | */ |
||
105 | public function accept(ElementVisitorInterface $visitor) |
||
109 | } |