| Total Complexity | 5 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class Emoji extends InlineNode |
||
| 13 | { |
||
| 14 | protected string $type = 'emoji'; |
||
| 15 | private string $shortName; |
||
| 16 | private ?string $id; |
||
| 17 | private ?string $text; |
||
| 18 | |||
| 19 | public function __construct(string $shortName, ?string $id = null, ?string $text = null) |
||
| 20 | { |
||
| 21 | $this->shortName = $shortName; |
||
| 22 | $this->id = $id; |
||
| 23 | $this->text = $text; |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function load(array $data): self |
||
| 27 | { |
||
| 28 | self::checkNodeData(static::class, $data, ['attrs']); |
||
| 29 | self::checkRequiredKeys(['shortName'], $data['attrs']); |
||
| 30 | |||
| 31 | return new self(trim($data['attrs']['shortName'], ' \t\n\r\0\x0B:'), $data['attrs']['id'] ?? null, $data['attrs']['text'] ?? null); |
||
| 32 | } |
||
| 33 | |||
| 34 | protected function attrs(): array |
||
| 47 | } |
||
| 48 | } |
||
| 49 |