src/Node/Node.php
public function findChildren(array $filters = [], array $options = [])
    {
        $options = array_replace(
            [
                'returnFirstResult'     => false
            ],
            $options
        );

        if (empty($filters)) {
            $result = array_values($this->_nodes);
        } else if (count($filters) === 1
            && isset($filters['id'])
        ) {
            $result = $this->hasNode($filters['id']) ?
                [$this->getNode($filters['id'])] :
                [];
        } else {
            $result = [];

            /** @var NodeInterface $child */
            foreach ($this->getNodes() as $child) {
                foreach ($filters as $f => $v) {
                    $method = 'get'.ucfirst($f);

                    if (!method_exists($child, $method) || $child->$method() !== $v) {
                        continue 2;
                    }
                }

                $result[] = $child;
            }
        }

        return $options['returnFirstResult'] && $result ?
            $result[0] :
            $result;
    }
public function findChildren(array $filters = [], array $options = [])
    {
        $options = array_replace(
            [
                'returnFirstResult'     => false
            ],
            $options
        );

        if (empty($filters)) {
            $result = array_values($this->_nodes);
        } else if (count($filters) === 1
            && isset($filters['id'])
        ) {
            $result = $this->hasNode($filters['id']) ?
                [$this->getNode($filters['id'])] :
                [];
        } else {
            $result = [];

            /** @var NodeInterface $child */
            foreach ($this->getNodes() as $child) {
                foreach ($filters as $f => $v) {
                    $method = 'get'.ucfirst($f);

                    if (!method_exists($child, $method) || $child->$method() !== $v) {
                        continue 2;
                    }
                }

                $result[] = $child;
            }
        }

        return $options['returnFirstResult'] && $result ?
            $result[0] :
            $result;
    }
public function findChildren ( array $ filters = [ ] , array $ options = [ ] ) { $ options = array_replace ( [ 'returnFirstResult' => false ] , $ options ) ; if ( empty ( $ filters ) ) { $ result = array_values ( $ this -> _nodes ) ; } else if ( count ( $ filters ) === 1 && isset ( $ filters [ 'id' ] ) ) { $ result = $ this -> hasNode ( $ filters [ 'id' ] ) ? [ $ this -> getNode ( $ filters [ 'id' ] ) ] : [ ] ; } else { $ result = [ ] ; /** @var NodeInterface $child */ foreach ( $ this -> getNodes ( ) as $ child ) { foreach ( $ filters as $ f => $ v ) { $ method = 'get' . ucfirst ( $ f ) ; if ( ! method_exists ( $ child , $ method ) || $ child -> $ method ( ) !== $ v ) { continue 2 ; } } $ result [ ] = $ child ; } } return $ options [ 'returnFirstResult' ] && $ result ? $ result [ 0 ] : $ result ; }
Finds children.

@param array $filters - Filters.
@param array $options - Options.

@return array|NodeInterface
Finds children .