API / Minn\Html\Tree / Token

Token final readonly class

Minn\Html\Tree\Token · public/minn/src/Minn/Html/Tree/Token.php · 45 lines

A token as the tree builder reads it: a tag (name upper-cased), a run of text (one kind at a time: NUL bytes, white space, or anything else), a comment-like leaf, or the end of the input.

Constants and properties

constCLOSER = 1
constSELF_CLOSING = 2
propreadonly string $type

Promoted from the constructor.

propreadonly string $name

Promoted from the constructor.

propreadonly int $flags

Promoted from the constructor.

propreadonly int $offset

Promoted from the constructor.

propreadonly string $text

Promoted from the constructor.

propreadonly string $kind

Promoted from the constructor.

Public

new__construct(string $type, string $name, int $flags, int $offset, string $text = '', string $kind = '')#
methodisStart(string ...$names): bool#

Whether this is a start tag with one of the names (any name when none are given).

methodisEnd(string ...$names): bool#

Whether this is an end tag with one of the names (any name when none are given).

methodselfClosing(): bool#

Whether the tag was written with "/>".

methodisText(string $kind): bool#

Whether this is a run of text of the kind ("null", "whitespace", "generic").

methodrenamed(string $name, int $flags): self#

The same token under another name (an "image" start tag read as "img", "</br>" as "<br>").