RemexHtml
Fast HTML 5 parser
Loading...
Searching...
No Matches
Wikimedia\RemexHtml\Tokenizer\LazyAttributes Class Reference

An Attributes implementation which defers interpretation of regex match results until the caller requires them. More...

+ Inheritance diagram for Wikimedia\RemexHtml\Tokenizer\LazyAttributes:

Public Member Functions

 __construct ( $data, callable $interpreter)
 
 offsetExists ( $offset)
 
offsetGet ( $offset)
 
 offsetSet ( $offset, $value)
 
 offsetUnset ( $offset)
 
 getValues ()
 Get the attributes as a key/value array.
 
 getObjects ()
 Get the attributes as an array of Attribute objects.
 
 count ()
 Get the number of attributes.
 
 getIterator ()
 
 merge (Attributes $other)
 Add any attributes in the argument to $this, but if an attribute of the same name already exists, do not overwrite it.
 
 clone ()
 It's efficient to assume that attributes are immutable when cloning nodes due to AFE reconstruction or AAA.
 

Detailed Description

An Attributes implementation which defers interpretation of regex match results until the caller requires them.

This should not be directly instantiated outside of Tokenizer.

Member Function Documentation

◆ clone()

Wikimedia\RemexHtml\Tokenizer\LazyAttributes::clone ( )

It's efficient to assume that attributes are immutable when cloning nodes due to AFE reconstruction or AAA.

So by default, this returns $this. But users can override it if attribute cloning needs special handling.

Returns
Attributes

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ count()

Wikimedia\RemexHtml\Tokenizer\LazyAttributes::count ( )

Get the number of attributes.

This may include duplicates, and so may be larger than count( $this->getValues() ). Including duplicates gives us an efficient way to distinguish zero attributes from non-zero but is not compliant with the spec, which states that duplicate attributes must be removed.

Returns
int

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ getObjects()

Wikimedia\RemexHtml\Tokenizer\LazyAttributes::getObjects ( )

Get the attributes as an array of Attribute objects.

Returns
Attribute[]

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ getValues()

Wikimedia\RemexHtml\Tokenizer\LazyAttributes::getValues ( )

Get the attributes as a key/value array.

Returns
string[]

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.

◆ merge()

Wikimedia\RemexHtml\Tokenizer\LazyAttributes::merge ( Attributes $other)

Add any attributes in the argument to $this, but if an attribute of the same name already exists, do not overwrite it.

Parameters
Attributes$other

Implements Wikimedia\RemexHtml\Tokenizer\Attributes.


The documentation for this class was generated from the following file: