PHP Class PHPHtmlParser\Dom\Collection

Inheritance: implements IteratorAggregat\IteratorAggregate, implements ArrayAcces\ArrayAccess, implements Countabl\Countable
Show file Open project: paquettg/php-html-parser Class Usage Examples

Protected Properties

Property Type Description
$collection The collection of Nodes.

Public Methods

Method Description
__call ( string $method, array $arguments ) : mixed; Attempts to call the method on the first node in the collection.
__get ( mixed $key ) : mixed Attempts to apply the magic get to the first node in the collection.
__toString ( ) : string Applies the magic string method to the first node in the collection.
count ( ) : integer Returns the count of the collection.
each ( callback $callback ) Similar to jQuery "each" method. Calls the callback with each Node in this collection.
getIterator ( ) : ArrayIterator Returns an iterator for the collection.
offsetExists ( mixed $offset ) : boolean Checks if an offset exists.
offsetGet ( mixed $offset ) : mixed Gets a node at the given offset, or null
offsetSet ( mixed $offset, mixed $value ) Set an attribute by the given offset
offsetUnset ( mixed $offset ) Unset a collection Node.
toArray ( ) : array Returns this collection as an array.

Method Details

__call() public method

Attempts to call the method on the first node in the collection.
public __call ( string $method, array $arguments ) : mixed;
$method string
$arguments array
return mixed;

__get() public method

Attempts to apply the magic get to the first node in the collection.
public __get ( mixed $key ) : mixed
$key mixed
return mixed

__toString() public method

Applies the magic string method to the first node in the collection.
public __toString ( ) : string
return string

count() public method

Returns the count of the collection.
public count ( ) : integer
return integer

each() public method

Similar to jQuery "each" method. Calls the callback with each Node in this collection.
public each ( callback $callback )
$callback callback

getIterator() public method

Returns an iterator for the collection.

offsetExists() public method

Checks if an offset exists.
public offsetExists ( mixed $offset ) : boolean
$offset mixed
return boolean

offsetGet() public method

Gets a node at the given offset, or null
public offsetGet ( mixed $offset ) : mixed
$offset mixed
return mixed

offsetSet() public method

Set an attribute by the given offset
public offsetSet ( mixed $offset, mixed $value )
$offset mixed
$value mixed

offsetUnset() public method

Unset a collection Node.
public offsetUnset ( mixed $offset )
$offset mixed

toArray() public method

Returns this collection as an array.
public toArray ( ) : array
return array

Property Details

$collection protected property

The collection of Nodes.
protected $collection