| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 10 | final class EmojiImage extends AbstractEmoji |
||
| 11 | { |
||
| 12 | /** @var HtmlElement */ |
||
| 13 | private $element; |
||
| 14 | |||
| 15 | public function __construct(string $value, Emoji $emoji, string $url, ?string $alt = null) |
||
| 16 | { |
||
| 17 | parent::__construct($value, $emoji); |
||
| 18 | |||
| 19 | $this->element = new HtmlElement('img', [], '', true); |
||
| 20 | |||
| 21 | $this->element->setAttribute('src', $url); |
||
| 22 | |||
| 23 | if ($alt !== null) { |
||
| 24 | $this->element->setAttribute('alt', $alt); |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | public function addClass(string ...$classes): void |
||
| 31 | } |
||
| 32 | |||
| 33 | public function getElement(): HtmlElement |
||
| 34 | { |
||
| 35 | return $this->element; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getLiteral(): string |
||
| 39 | { |
||
| 40 | return (string) $this->element; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getUrl(): string |
||
| 44 | { |
||
| 45 | return (string) $this->element->getAttribute('src'); |
||
| 46 | } |
||
| 47 | |||
| 48 | public function setAttribute(string $name, string $value): void |
||
| 51 | } |
||
| 52 | } |
||
| 53 |