charCodeHtml = $charCodeHtml; $this->width = \strlen($charCodeHtml) + 2; } /** * @param Excerpt $Excerpt * @param State $State * @return static|null */ public static function build(Excerpt $Excerpt, State $State) { if (\preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt->text(), $matches)) { return new self($matches[1]); } return null; } /** @return string */ public function charCode() { return $this->charCodeHtml; } /** * @return RawHtml */ public function stateRenderable() { return new RawHtml( '&' . (new Text($this->charCode()))->getHtml() . ';' ); } /** * @return Text */ public function bestPlaintext() { return new Text('&'.$this->charCode().';'); } }