| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class AttributeNode extends NaryNode implements AttributeNodeInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | private $attributes; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * ValueNode constructor. |
||
| 23 | * |
||
| 24 | * @param array<int|string, mixed> $attributes |
||
| 25 | */ |
||
| 26 | 10 | public function __construct( |
|
| 27 | array $attributes = [], |
||
| 28 | int $capacity = 0, |
||
| 29 | ?TraverserInterface $traverser = null, |
||
| 30 | ?NodeInterface $parent = null |
||
| 31 | ) { |
||
| 32 | 10 | parent::__construct($capacity, $traverser, $parent); |
|
| 33 | |||
| 34 | 10 | $this->attributes = $attributes; |
|
| 35 | 10 | } |
|
| 36 | |||
| 37 | 4 | public function getAttribute(string $key) |
|
| 38 | { |
||
| 39 | 4 | return $this->getAttributes()[$key] ?? null; |
|
| 40 | } |
||
| 41 | |||
| 42 | 4 | public function getAttributes(): array |
|
| 43 | { |
||
| 44 | 4 | return $this->attributes; |
|
| 45 | } |
||
| 46 | |||
| 47 | 2 | public function label(): string |
|
| 48 | { |
||
| 49 | 2 | return (string) $this->getAttribute('label'); |
|
| 50 | } |
||
| 51 | |||
| 52 | 2 | public function setAttribute(string $key, $value): AttributeNodeInterface |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public function setAttributes(array $attributes): AttributeNodeInterface |
|
| 60 | { |
||
| 64 | } |
||
| 65 | } |
||
| 66 |