Documentation

NodeFinder
in package

Table of Contents

Methods

find()  : array<string|int, Node>
Find all nodes satisfying a filter callback.
findFirst()  : null|Node
Find first node satisfying a filter callback.
findFirstInstanceOf()  : null|TNode
Find first node that is an instance of a certain class.
findInstanceOf()  : array<string|int, TNode>
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, TNode> $class) : null|TNode
Parameters
$nodes : Node|array<string|int, Node>

Single node or array of nodes to search in

$class : TNode>

Class name

Tags
template

TNode as Node

Return values
null|TNode

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, TNode> $class) : array<string|int, TNode>
Parameters
$nodes : Node|array<string|int, Node>

Single node or array of nodes to search in

$class : TNode>

Class name

Tags
template

TNode as Node

Return values
array<string|int, TNode>

Found nodes (all instances of $class)


        
On this page

Search results