Documentation

NodeFinder
in package

Table of Contents

find()  : array<string|int, Node>
Find all nodes satisfying a filter callback.
findFirst()  : null|Node
Find first node satisfying a filter callback.
findFirstInstanceOf()  : null|Node
Find first node that is an instance of a certain class.
findInstanceOf()  : array<string|int, Node>
Find all nodes that are instances of a certain class.

Methods

find()

Find all nodes satisfying a filter callback.

public find(Node|array<string|int, Node$nodes, callable $filter) : array<string|int, Node>
Parameters
$nodes : Node|array<string|int, Node>

Single node or array of nodes to search in

$filter : callable

Filter callback: function(Node $node) : bool

Return values
array<string|int, Node>

Found nodes satisfying the filter callback

findFirst()

Find first node satisfying a filter callback.

public findFirst(Node|array<string|int, Node$nodes, callable $filter) : null|Node
Parameters
$nodes : Node|array<string|int, Node>

Single node or array of nodes to search in

$filter : callable

Filter callback: function(Node $node) : bool

Return values
null|Node

Found node (or null if none found)

findFirstInstanceOf()

Find first node that is an instance of a certain class.

public findFirstInstanceOf(Node|array<string|int, Node$nodes, string $class) : null|Node
Parameters
$nodes : Node|array<string|int, Node>

Single node or array of nodes to search in

$class : string

Class name

Return values
null|Node

Found node, which is an instance of $class (or null if none found)

findInstanceOf()

Find all nodes that are instances of a certain class.

public findInstanceOf(Node|array<string|int, Node$nodes, string $class) : array<string|int, Node>
Parameters
$nodes : Node|array<string|int, Node>

Single node or array of nodes to search in

$class : string

Class name

Return values
array<string|int, Node>

Found nodes (all instances of $class)

Search results