protected function getQuery($query = array()) { $cryptography = new Cryptography(); for ($ind = 0; $ind < count($query); $ind += 3) { if (empty($query[$ind])) { unset($query[$ind]); unset($query[$ind + 1]); unset($query[$ind + 2]); $query = array_values($query); if (isset($query[$ind]) && in_array($query[$ind], array('$or', '$and', '$ne', '$gt', '$gte', '$lt', '$lte'))) { unset($query[$ind]); $query = array_values($query); } $ind -= 3; } } if (count($query) == 0) { return $query; } else { if (count($query) == 3) { $query = $cryptography->executeValue($query, 2); return $query; } } $query = $cryptography->executeAND($query); $query = $cryptography->executeOR($query); //$this->debug($query); return $query[0]; }