PHP Class FluentDOM\Query\Attributes

It acts like the FluentDOM\Query::attr() method. If you read attributes it uses the first selected node. Write actions are applied to all matches element nodes.
Inheritance: implements ArrayAccess, implements Countable, implements IteratorAggregate
Mostrar archivo Open project: fluentdom/fluentdom

Public Methods

Method Description
__construct ( Query $fd ) Store the FluentDOM instance for later use
count ( ) : integer Get the attribute count of the first selected node
getIterator ( ) : Iterator Get an iterator for the attributes of the first node
offsetExists ( string $name ) : boolean Check if the first selected node has the specified attribute
offsetGet ( string $name ) : string Read the specified attribute from the first node
offsetSet ( string $name, string $value ) Set the attribute on all selected element nodes
offsetUnset ( string | array $name ) Remove the attribute(s) on all selected element nodes
toArray ( ) : array Convert the attributes of the first node into an array

Private Methods

Method Description
getFirstElement ( ) : DOMElement | null

Method Details

__construct() public method

Store the FluentDOM instance for later use
public __construct ( Query $fd )
$fd FluentDOM\Query

count() public method

Get the attribute count of the first selected node
See also: Countable::count()
public count ( ) : integer
return integer

getIterator() public method

Get an iterator for the attributes of the first node
See also: IteratorAggregate::getIterator()
public getIterator ( ) : Iterator
return Iterator

offsetExists() public method

Check if the first selected node has the specified attribute
See also: ArrayAccess::offsetExists()
public offsetExists ( string $name ) : boolean
$name string
return boolean

offsetGet() public method

Read the specified attribute from the first node
See also: ArrayAccess::offsetGet()
See also: FluentDOM::attr()
public offsetGet ( string $name ) : string
$name string
return string

offsetSet() public method

Set the attribute on all selected element nodes
See also: ArrayAccess::offsetSet()
See also: FluentDOM::attr()
public offsetSet ( string $name, string $value )
$name string
$value string

offsetUnset() public method

Remove the attribute(s) on all selected element nodes
See also: ArrayAccess::offsetUnset()
See also: FluentDOM::removeAttr()
public offsetUnset ( string | array $name )
$name string | array

toArray() public method

Convert the attributes of the first node into an array
public toArray ( ) : array
return array