class Selector (View source)

Methods

__construct(DOMDocument $document, bool $registerNodeNS = true)

Create a Inphinit\Dom\Selector instance.

xpath()

Get DOMXPath instance

int|false
count(string $selector)

Count all nodes matching the given CSS selector. If the selector is not valid, it will return false.

all(string $selector)

Returns a \DOMNodeList that match the specified selector

first(string $selector)

Returns the first element or node within the document that matches the specified selector.

Details

__construct(DOMDocument $document, bool $registerNodeNS = true)

Create a Inphinit\Dom\Selector instance.

Parameters

DOMDocument $document
bool $registerNodeNS

DOMXPath xpath()

Get DOMXPath instance

Return Value

DOMXPath

int|false count(string $selector)

Count all nodes matching the given CSS selector. If the selector is not valid, it will return false.

Parameters

string $selector

Return Value

int|false

DOMNodeList all(string $selector)

Returns a \DOMNodeList that match the specified selector

Parameters

string $selector

Return Value

DOMNodeList

DOMElement|DOMNode|DOMNameSpaceNode|null first(string $selector)

Returns the first element or node within the document that matches the specified selector.

If no matches are found, null is returned.

Parameters

string $selector

Return Value

DOMElement|DOMNode|DOMNameSpaceNode|null