NodeList implements SeekableIterator, ArrayAccess, Countable
Interfaces, Classes and Traits
- SeekableIterator
- ArrayAccess
- Countable
Table of Contents
- $array : array<string|int, mixed>
- $offset : int
- __construct() : mixed
- NodeList constructor.
- clear() : NodeList
- Clears the array (makes it empty) and returns the array reference.
- count() : int
- current() : DOMNode|PrototypeHTMLElement|null
- each() : NodeList
- Calls iterator for each item in the collection.
- findAll() : array<string|int, \chillerlan\PrototypeDOM\Node\PrototypeNode|\chillerlan\PrototypeDOM\Node\PrototypeHTMLElement|\DOMNode>
- Returns all the elements for which the iterator returned a truthy value.
- first() : DOMNode|PrototypeHTMLElement|null
- Returns the array's first item
- fromIterable() : NodeList
- inspect() : string
- Returns the debug-oriented string representation of the object.
- item() : DOMNode|PrototypeHTMLElement|null
- Returns the item on $offset or null if none is found
- key() : int
- last() : DOMNode|PrototypeHTMLElement|null
- Returns the array's last item
- map() : array<string|int, mixed>
- Returns the result of applying iterator to each element.
- match() : bool
- Checks if an element in the NodeList matches the given DOMNode
- merge() : NodeList
- Merges one NodeList into another
- next() : void
- offsetExists() : bool
- offsetGet() : DOMNode|PrototypeHTMLElement|null
- offsetSet() : DOMNode|PrototypeHTMLElement|null
- offsetUnset() : void
- pluck() : array<string|int, mixed>
- Pre-baked implementation for a common use-case of Enumerable#collect and Enumerable#each: fetching the same property for all of the elements. Returns an array of the property values.
- reject() : array<string|int, \chillerlan\PrototypeDOM\Node\PrototypeNode|\chillerlan\PrototypeDOM\Node\PrototypeHTMLElement|\DOMNode>
- Returns all the elements for which the iterator returns a falsy value.
- reverse() : NodeList
- Reverses the array's contents.
- rewind() : void
- seek() : void
- toArray() : array<string|int, mixed>
- Returns an Array containing the elements of the enumeration.
- valid() : bool
Properties
$array
protected
array<string|int, mixed>
$array
= []
$offset
protected
int
$offset
= 0
Methods
__construct()
NodeList constructor.
public
__construct([iteratable<string|int, mixed> $nodes = null ]) : mixed
Parameters
- $nodes : iteratable<string|int, mixed> = null
Return values
mixed —clear()
Clears the array (makes it empty) and returns the array reference.
public
clear() : NodeList
Tags
Return values
NodeList —count()
public
count() : int
Tags
Return values
int —current()
public
current() : DOMNode|PrototypeHTMLElement|null
Tags
Return values
DOMNode|PrototypeHTMLElement|null —each()
Calls iterator for each item in the collection.
public
each(callable|Closure $iterator) : NodeList
Parameters
- $iterator : callable|Closure
Tags
Return values
NodeList —findAll()
Returns all the elements for which the iterator returned a truthy value.
public
findAll(callable|Closure $iterator) : array<string|int, \chillerlan\PrototypeDOM\Node\PrototypeNode|\chillerlan\PrototypeDOM\Node\PrototypeHTMLElement|\DOMNode>
For the opposite operation, see Enumerable#reject.
Parameters
- $iterator : callable|Closure
Tags
Return values
array<string|int, \chillerlan\PrototypeDOM\Node\PrototypeNode|\chillerlan\PrototypeDOM\Node\PrototypeHTMLElement|\DOMNode> —first()
Returns the array's first item
public
first() : DOMNode|PrototypeHTMLElement|null
Tags
Return values
DOMNode|PrototypeHTMLElement|null —fromIterable()
public
fromIterable(iteratable<string|int, mixed> $nodes) : NodeList
Parameters
- $nodes : iteratable<string|int, mixed>
Return values
NodeList —inspect()
Returns the debug-oriented string representation of the object.
public
inspect([bool $xml = false ]) : string
Parameters
- $xml : bool = false
Tags
Return values
string —item()
Returns the item on $offset or null if none is found
public
item(int $offset) : DOMNode|PrototypeHTMLElement|null
Parameters
- $offset : int
Return values
DOMNode|PrototypeHTMLElement|null —key()
public
key() : int
Tags
Return values
int —last()
Returns the array's last item
public
last() : DOMNode|PrototypeHTMLElement|null
Tags
Return values
DOMNode|PrototypeHTMLElement|null —map()
Returns the result of applying iterator to each element.
public
map(callable|Closure $iterator) : array<string|int, mixed>
Parameters
- $iterator : callable|Closure
Tags
Return values
array<string|int, mixed> —match()
Checks if an element in the NodeList matches the given DOMNode
public
match(DOMNode $node) : bool
Parameters
- $node : DOMNode
Return values
bool —merge()
Merges one NodeList into another
public
merge(NodeList $nodelist) : NodeList
Parameters
- $nodelist : NodeList
Return values
NodeList —next()
public
next() : void
Tags
Return values
void —offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Tags
Return values
bool —offsetGet()
public
offsetGet(mixed $offset) : DOMNode|PrototypeHTMLElement|null
Parameters
- $offset : mixed
Tags
Return values
DOMNode|PrototypeHTMLElement|null —offsetSet()
public
offsetSet(mixed $offset, mixed $value) : DOMNode|PrototypeHTMLElement|null
Parameters
- $offset : mixed
- $value : mixed
Tags
Return values
DOMNode|PrototypeHTMLElement|null —offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Tags
Return values
void —pluck()
Pre-baked implementation for a common use-case of Enumerable#collect and Enumerable#each: fetching the same property for all of the elements. Returns an array of the property values.
public
pluck(string $property) : array<string|int, mixed>
Parameters
- $property : string
Tags
Return values
array<string|int, mixed> —reject()
Returns all the elements for which the iterator returns a falsy value.
public
reject(callable|Closure $iterator) : array<string|int, \chillerlan\PrototypeDOM\Node\PrototypeNode|\chillerlan\PrototypeDOM\Node\PrototypeHTMLElement|\DOMNode>
For the opposite operation, see Enumerable#findAll.
Parameters
- $iterator : callable|Closure
Tags
Return values
array<string|int, \chillerlan\PrototypeDOM\Node\PrototypeNode|\chillerlan\PrototypeDOM\Node\PrototypeHTMLElement|\DOMNode> —reverse()
Reverses the array's contents.
public
reverse() : NodeList
Tags
Return values
NodeList —rewind()
public
rewind() : void
Tags
Return values
void —seek()
public
seek(mixed $offset) : void
Parameters
- $offset : mixed
Tags
Return values
void —toArray()
Returns an Array containing the elements of the enumeration.
public
toArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —valid()
public
valid() : bool