class Tag

Constants

START_TAG

Tag type: start tag

END_TAG

Tag type: end tag

SELF_CLOSING_TAG

Tag type: self-closing tag

Properties

protected array $attributes
protected array $cascade
protected Tag $endTag
protected int $flags
protected bool $invalid
protected int $len
protected string $name
protected int $pos
protected int $sortPriority
protected Tag $startTag
protected int $type

Methods

__construct(int $type, string $name, int $pos, int $len, int $priority = 0)

Constructor

void
addFlags(int $flags)

Add a set of flags to this tag's

void
cascadeInvalidationTo(Tag $tag)

Set given tag to be invalidated if this tag is invalidated

void
invalidate()

Invalidate this tag, as well as tags bound to this tag

void
pairWith(Tag $tag)

Pair this tag with given tag

bool
canBePaired(Tag $startTag, Tag $endTag)

Test whether two tags can be paired

void
removeFlags(int $flags)

Remove a set of flags from this tag's

void
setFlags(int $flags)

Set the bitfield of boolean rules that apply to this tag

array
getAttributes()

Return this tag's attributes

Tag|null
getEndTag()

Return this tag's end tag

int
getFlags()

Return the bitfield of boolean rules that apply to this tag

int
getLen()

Return the length of text consumed by this tag

string
getName()

Return this tag's name

int
getPos()

Return this tag's position

int
getSortPriority()

Return this tag's tiebreaker

Tag|null
getStartTag()

Return this tag's start tag

int
getType()

Return this tag's type

bool
canClose(Tag $startTag)

Test whether this tag can close given start tag

bool
isBrTag()

Test whether this tag is a br tag

bool
isEndTag()

Test whether this tag is an end tag (self-closing tags inclusive)

bool
isIgnoreTag()

Test whether this tag is an ignore tag

bool
isInvalid()

Test whether this tag is invalid

bool
isParagraphBreak()

Test whether this tag represents a paragraph break

bool
isSelfClosingTag()

Test whether this tag is a self-closing tag

bool
isSystemTag()

Test whether this tag is a special tag: "br", "i", "pb" or "v"

bool
isStartTag()

Test whether this tag is a start tag (self-closing tags inclusive)

bool
isVerbatim()

Test whether this tag represents verbatim text

mixed
getAttribute(string $attrName)

Return the value of given attribute

bool
hasAttribute(string $attrName)

Return whether given attribute is set

void
removeAttribute(string $attrName)

Remove given attribute

void
setAttribute(string $attrName, string $attrValue)

Set the value of an attribute

void
setAttributes(array $attributes)

Set all of this tag's attributes at once

Details

at line 91
__construct(int $type, string $name, int $pos, int $len, int $priority = 0)

Constructor

Parameters

int $type

Tag's type

string $name

Name of the tag

int $pos

Position of the tag in the text

int $len

Length of text consumed by the tag

int $priority

This tag's sorting tiebreaker

at line 110
void addFlags(int $flags)

Add a set of flags to this tag's

Parameters

int $flags

Return Value

void

at line 121
void cascadeInvalidationTo(Tag $tag)

Set given tag to be invalidated if this tag is invalidated

Parameters

Tag $tag

Return Value

void

at line 137
void invalidate()

Invalidate this tag, as well as tags bound to this tag

Return Value

void

at line 156
void pairWith(Tag $tag)

Pair this tag with given tag

Parameters

Tag $tag

Return Value

void

at line 175
protected bool canBePaired(Tag $startTag, Tag $endTag)

Test whether two tags can be paired

Parameters

Tag $startTag
Tag $endTag

Return Value

bool

at line 186
void removeFlags(int $flags)

Remove a set of flags from this tag's

Parameters

int $flags

Return Value

void

at line 197
void setFlags(int $flags)

Set the bitfield of boolean rules that apply to this tag

Parameters

int $flags

Bitfield of boolean rules that apply to this tag

Return Value

void

at line 211
array getAttributes()

Return this tag's attributes

Return Value

array

at line 221
Tag|null getEndTag()

Return this tag's end tag

Return Value

Tag|null

This tag's end tag, or NULL if none is set

at line 231
int getFlags()

Return the bitfield of boolean rules that apply to this tag

Return Value

int

at line 241
int getLen()

Return the length of text consumed by this tag

Return Value

int

at line 251
string getName()

Return this tag's name

Return Value

string

at line 261
int getPos()

Return this tag's position

Return Value

int

at line 271
int getSortPriority()

Return this tag's tiebreaker

Return Value

int

at line 281
Tag|null getStartTag()

Return this tag's start tag

Return Value

Tag|null

This tag's start tag, or NULL if none is set

at line 291
int getType()

Return this tag's type

Return Value

int

at line 306
bool canClose(Tag $startTag)

Test whether this tag can close given start tag

Parameters

Tag $startTag

A start tag

Return Value

bool

at line 324
bool isBrTag()

Test whether this tag is a br tag

Return Value

bool

at line 334
bool isEndTag()

Test whether this tag is an end tag (self-closing tags inclusive)

Return Value

bool

at line 344
bool isIgnoreTag()

Test whether this tag is an ignore tag

Return Value

bool

at line 354
bool isInvalid()

Test whether this tag is invalid

Return Value

bool

at line 364
bool isParagraphBreak()

Test whether this tag represents a paragraph break

Return Value

bool

at line 374
bool isSelfClosingTag()

Test whether this tag is a self-closing tag

Return Value

bool

at line 384
bool isSystemTag()

Test whether this tag is a special tag: "br", "i", "pb" or "v"

Return Value

bool

at line 394
bool isStartTag()

Test whether this tag is a start tag (self-closing tags inclusive)

Return Value

bool

at line 404
bool isVerbatim()

Test whether this tag represents verbatim text

Return Value

bool

at line 419
mixed getAttribute(string $attrName)

Return the value of given attribute

Parameters

string $attrName

Return Value

mixed

at line 430
bool hasAttribute(string $attrName)

Return whether given attribute is set

Parameters

string $attrName

Return Value

bool

at line 441
void removeAttribute(string $attrName)

Remove given attribute

Parameters

string $attrName

Return Value

void

at line 453
void setAttribute(string $attrName, string $attrValue)

Set the value of an attribute

Parameters

string $attrName

Attribute's name

string $attrValue

Attribute's value

Return Value

void

at line 464
void setAttributes(array $attributes)

Set all of this tag's attributes at once

Parameters

array $attributes

Return Value

void