for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace UnicornFail\Emoji\Node\Inline;
use UnicornFail\Emoji\Dataset\Emoji;
use UnicornFail\Emoji\Util\HtmlElement;
final class EmojiImage extends AbstractEmoji
{
/** @var HtmlElement */
private $element;
public function __construct(string $value, Emoji $emoji, string $url, ?string $alt = null)
parent::__construct($value, $emoji);
$this->element = new HtmlElement('img', [], '', true);
$this->element->setAttribute('src', $url);
if ($alt !== null) {
$this->element->setAttribute('alt', $alt);
}
public function addClass(string ...$classes): void
$this->element->addClass(...$classes);
public function getElement(): HtmlElement
return $this->element;
public function getLiteral(): string
return (string) $this->element;
public function getUrl(): string
return (string) $this->element->getAttribute('src');
public function setAttribute(string $name, string $value): void
$this->data->set('attributes.' . $name, $value);