selectTerm; if ($this->validAliasString($alias)) { $query .= $this->aliasTerm . $this->quoteTerm . $alias . $this->quoteTerm . $this->addDomainTerm($domain); } else { return null; } // send query return $this->query($query); } /** * Methods send an query for the sps-service depends of coordinates * @param array $queryArgs * @return array [num][assoc] */ public function sendSpsCoordinateQuery($queryArgs) { // check arguments of the query if (array_key_exists(\api\SpsApi::$keyPoly, $queryArgs)) { $poly = $queryArgs[\api\SpsApi::$keyPoly]; } else { return null; } $domain = null; if (array_key_exists(\api\SpsApi::$keyDomain, $queryArgs)) { $domain = $queryArgs[\api\SpsApi::$keyDomain]; } // build query string if ($this->validPolyString($poly)) { $query = $this->selectTerm . $this->interSectTermStart . $poly . $this->interSectTermEnd . $this->addDomainTerm($domain); } else { return null; } // send query return $this->query($query); } /** * Method create the correct domain part depends of $domain. If it is a number => did * otherwise => dName * @param string $domain * @return string */ private function addDomainTerm($domain) { $result = null; if ($domain != null && $this->validDomainString($domain)) { if ($this->isDid($domain)) { $result .= $this->andTerm . $this->domainTerm . $this->quoteTerm . $domain . $this->quoteTerm; } else { $result .= $this->andTerm . $this->domainNameTerm . $this->quoteTerm . $domain . $this->quoteTerm; } } return $result; } /** * Method check if the input value for the alias is valid * @param string $alias * @return boolean */ private function validAliasString($alias) { if ($this->validString($alias) && ctype_alnum($alias) && strlen($alias) <= $this->aliasMaxLenght) { return TRUE; } return FALSE; } /** * Method check if the input value for the alias is valid * @param string $domain * @return boolean */ private function validDomainString($domain) { if ($this->validString($domain) && ctype_alnum($domain) && strlen($domain) <= $this->domainMaxLenght) { return TRUE; } return FALSE; } /** * Method check if the input value for the polygon is valid * @param string $poly * @return boolean */ private function validPolyString($poly) { if ($this->validString($poly) && \utiliy\StringManager::startsWith($poly, $this->polyStartStr) && \utiliy\StringManager::endsWith($poly, $this->polyEndStr)) { return TRUE; } return FALSE; } /** * Method check if the ntring is a did * @param string $string * @return boolean */ private function isDid($string) { return ctype_digit($string); } } ?>