public function find($expression)
    {
        $tokens = $this->parseTokens($expression);

        $collectionData = [$this->data];

        foreach ($tokens as $token) {
            $filter = $token->buildFilter($this->options);

            $filteredData = [];

            foreach ($collectionData as $value) {
                if (AccessHelper::isCollectionType($value)) {
                    $filteredValue = $filter->filter($value);
                    $filteredData = array_merge($filteredData, $filteredValue);
                }
            }

            $collectionData = $filteredData;
        }


        return new static($collectionData, $this->options);
    }
public function find($expression)
    {
        $tokens = $this->parseTokens($expression);

        $collectionData = [$this->data];

        foreach ($tokens as $token) {
            $filter = $token->buildFilter($this->options);

            $filteredData = [];

            foreach ($collectionData as $value) {
                if (AccessHelper::isCollectionType($value)) {
                    $filteredValue = $filter->filter($value);
                    $filteredData = array_merge($filteredData, $filteredValue);
                }
            }

            $collectionData = $filteredData;
        }


        return new static($collectionData, $this->options);
    }
public function find ( $ expression ) { $ tokens = $ this -> parseTokens ( $ expression ) ; $ collectionData = [ $ this -> data ] ; foreach ( $ tokens as $ token ) { $ filter = $ token -> buildFilter ( $ this -> options ) ; $ filteredData = [ ] ; foreach ( $ collectionData as $ value ) { if ( AccessHelper :: isCollectionType ( $ value ) ) { $ filteredValue = $ filter -> filter ( $ value ) ; $ filteredData = array_merge ( $ filteredData , $ filteredValue ) ; } } $ collectionData = $ filteredData ; } return new static ( $ collectionData , $ this -> options ) ; }
Evaluate an expression

@param $expression
@return static
@throws JSONPathException
Evaluate an expression