public function toArray($query)
    {
        $nodes = $this->xpath->query((string) $query);
        if ($nodes->length) {
            $result = array();
            foreach ($nodes as $node) {
                $result[] = json_decode(
                    json_encode(
                        simplexml_load_string(
                            $this->dom->saveXML($node)
                        )
                    ),
                    true
                );
            }
            return $result;
        }
        return null;
    }
public function toArray($query)
    {
        $nodes = $this->xpath->query((string) $query);
        if ($nodes->length) {
            $result = array();
            foreach ($nodes as $node) {
                $result[] = json_decode(
                    json_encode(
                        simplexml_load_string(
                            $this->dom->saveXML($node)
                        )
                    ),
                    true
                );
            }
            return $result;
        }
        return null;
    }
public function toArray ( $ query ) { $ nodes = $ this -> xpath -> query ( ( string ) $ query ) ; if ( $ nodes -> length ) { $ result = array ( ) ; foreach ( $ nodes as $ node ) { $ result [ ] = json_decode ( json_encode ( simplexml_load_string ( $ this -> dom -> saveXML ( $ node ) ) ) , true ) ; } return $ result ; } return null ; }
Extract an XPath query as an associative array

@param string $query XPath query

@return array An array of matches converted to associative arrays. `null`
if no matches found.
Extract an XPath query as an associative array