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;
    }