| 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 | 14 | public function __construct(string $name, string $value = null) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * @return string |
||
| 45 | 13 | */ |
|
| 46 | final public function getName(): string |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return bool |
||
| 53 | 14 | */ |
|
| 54 | final public function hasValue(): bool |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string $value |
||
| 61 | 14 | */ |
|
| 62 | final public function setValue(string $value) |
||
| 66 | |||
| 67 | 14 | /** |
|
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | final public function getValue(): string |
||
| 74 | 12 | ||
| 75 | 12 | /** |
|
| 76 | * @param Attribute $attribute |
||
| 77 | */ |
||
| 78 | public function setAttribute(Attribute $attribute) |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return bool |
||
| 85 | */ |
||
| 86 | final public function hasAttributes(): bool |
||
| 90 | |||
| 91 | 14 | /** |
|
| 92 | * @return Attribute[] |
||
| 93 | 14 | */ |
|
| 94 | final public function getAttributes(): array |
||
| 98 | |||
| 99 | 3 | /** |
|
| 100 | * @param ElementVisitorInterface $visitor |
||
| 101 | 3 | */ |
|
| 102 | public function accept(ElementVisitorInterface $visitor) |
||
| 106 | } |