| Total Complexity | 4 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class ImageNode extends TextNode |
||
| 18 | { |
||
| 19 | /** @var array */ |
||
| 20 | private $attributes = []; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param TagNode|null $parent |
||
| 24 | * @param array $attributes |
||
| 25 | */ |
||
| 26 | 12 | public function __construct(?TagNode $parent, array $attributes = []) |
|
| 27 | { |
||
| 28 | 12 | parent::__construct($parent, \sprintf('<img>%s</img>', $attributes['src'] ?? '')); |
|
| 29 | 12 | $this->attributes = $attributes; |
|
| 30 | 12 | } |
|
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | 1 | public function isSameText(?Node $other): bool |
|
| 36 | { |
||
| 37 | 1 | if (!$other instanceof ImageNode) { |
|
| 38 | 1 | return false; |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | return $this->getText() === $other->getText(); |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return array |
||
| 46 | */ |
||
| 47 | 10 | public function getAttributes(): array |
|
| 50 | } |
||
| 51 | } |
||
| 52 |