Execute query

@param string $hostname

@return Dnsbl\Resolver\Response\InterfaceResponse
555739
public function execute($hostname)
    {
        $server = $this->getContext();

        $result = @file($this->location);

        $response = new Response\NetDnsResponse();
        $response->setHostname($hostname);
        $response->setServer($server);
        $response->setQuery($this->location);

        if ($result) {
            foreach ($result as $value) {
                if (trim($hostname) === trim($value)) {
                    $response->listed();
                }
            }
        }

        return $response;
    }
1143198
public function getServerByHostname(string $hostname): Server
    {
        if (!isset($this->servers[$hostname])) {
            throw ClusterException::serverNotFound($hostname);
        }

        return $this->servers[$hostname];
    }
1081949
public function resolve(string $domain, int $timeout) : Promised
    {
        $query = static function ($fn) use ($domain) {
            if (false === swoole_async_dns_lookup($domain, $fn)) {
                throw new ResolveFailedException($domain);
            }
        };

        $processor = function ($host, $ip) {
            if (self::validIP($ip)) {
                return new Result([$ip]);
            } else {
                throw new ResolveFailedException(sprintf('%s->%s', $host, $ip));
            }
        };

        return await($query, $processor, $timeout, ResolveTimeoutException::class, $domain);
    }
739105
protected function getDomain($domainName)
    {
        $entityManager = $this->getEntityManager();

        /** @var \Rcm\Repository\Domain $domainRepo */
        $domainRepo = $entityManager->getRepository(
            \Rcm\Entity\Domain::class
        );

        $domain = $domainRepo->getDomainByName($domainName);

        if (!$domain instanceof Domain) {
            throw new \Exception("Domain {$domainName} could not be found.");
        }

        return $domain;
    }
962788
public function setHostname(string $hostname)
    {
        $this->hostname = $hostname;

        $this->raw = array_merge($this->raw, ['Hostname' => $hostname]);

        return $this;
    }
495492
protected function setHost($hostname) {
        if (!is_string($hostname)) throw new IllegalTypeException('Illegal type of parameter $hostname: '.gettype($hostname));
        if (!strlen($hostname))    throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (empty)');

        $host = $hostname;
        $port = null;

        if (strpos($host, ':') !== false) {
            list($host, $port) = explode(':', $host, 2);
            $host = trim($host);
            if (!strlen($host)) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (empty host name)');

            $port = trim($port);
            if (!ctype_digit($port)) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (not a port)');
            $port = (int) $port;
            if (!$port || $port > 65535) throw new InvalidArgumentException('Invalid parameter $hostname: "'.$hostname.'" (illegal port)');
        }

        $this->host = $host;
        $this->port = $port;
        return $this;
    }
149566
public function get(string $query): ResponseInterface
    {
        return $this->client->request('get', $this->buildQuery($query), ['headers' => $this->getAuthorizationHeader()]);
    }
426479
public function fetchPage($pageName)
    {
        $pageName = (string) $pageName;

        if (!array_key_exists($pageName, $this->pages))
        {
            if ('' == $pageName)
            {
                $page = ContentPageQuery::create()
                    ->filterByIsPublished(true)
                    ->filterByName(null, Criteria::ISNULL)
                    ->_or()
                    ->filterByName('')
                    ->findOne()
                ;
            }
            else
            {
                $page = ContentPageQuery::create()
                    ->filterByIsPublished(true)
                    ->filterByName($pageName)
                    ->findOne()
                ;
            }

            $this->pages[$pageName] = $page;
        }

        return $this->pages[$pageName];
    }
1187544
public function executeQuery($query)
    {
        $results = $this->mysqliRef->query($query);
        if (!$results) {
            $mex = "Mysql error ".$this->mysqliRef->error." on '".$query."''";
            $this->log($mex);
            throw new MysqltcsException($mex);
        }else {
            $this->log($query);
            return $results;
        }
    }
364632
public function activateCommand($hostname)
    {
        $domains = $this->findDomainsByHostnamePattern($hostname);
        if (empty($domains)) {
            $this->outputLine('<error>No domain found for hostname-pattern "%s".</error>', [$hostname]);
            $this->quit(1);
        }
        foreach ($domains as $domain) {
            $domain->setActive(true);
            $this->domainRepository->update($domain);
            $this->outputLine('Domain entry "%s" was activated.', [$domain->getHostname()]);
        }
    }
843963
public function callback(string $hostname)
    {
        return function ($type, $buffer) use ($hostname) {
            foreach (explode("\n", rtrim($buffer)) as $line) {
                $this->writeln($type, $hostname, $line);
            }
        };
    }
993953
private function decodeHost($hostname)
    {
        if (preg_match('/^[\\x00-\\x7F]*$/', $hostname)) {
            return $hostname;
        } elseif ($this->mode !== self::MODE_IDNA2003) {
            throw new \InvalidArgumentException("Invalid hostname '$hostname'");
        }

        $hostname = idn_to_ascii($hostname);

        if ($hostname === false) {
            throw new \InvalidArgumentException("Invalid hostname '$hostname'");
        }

        return $hostname;
    }
289818
public static dnsaddrec get(nitro_service service, String hostname) throws Exception{
		dnsaddrec obj = new dnsaddrec();
		obj.set_hostname(hostname);
		dnsaddrec response = (dnsaddrec) obj.get_resource(service);
		return response;
	}
151613
public function getNamedQuery($queryName)
    {
        if ( ! isset($this->namedQueries[$queryName])) {
            throw MappingException::queryNotFound($this->name, $queryName);
        }
        return $this->namedQueries[$queryName]['dql'];
    }
238559
public function visitHostnameFormatConstraint(StringValue\HostnameFormatConstraint $constraint)
    {
        if (!$this->formatValidationEnabled()) {
            return $this->createResult();
        }

        $value = $this->currentValue();
        if (
            !$value instanceof Value\StringValue ||
            $this->hostnameValidator()->isValid($value->value())
        ) {
            return $this->createResult();
        }

        return $this->createSingleIssueResult($constraint);
    }
1181509
public static function isHostnameIP($hostname)
  {
    // IP-literal: encased in square brackets
    // we match starting [ character followed by non ] characters followed by ] character as last character in hostname
    if(preg_match('/^\[[^\]]\]$/',$hostname)){
      // ok its an IP-literal, we do not parse the literal to see if its valid
      return true;
    }
    // IPv4 in decimal
    if(preg_match('/^[0-9]+$/',$hostname)){
      // ok its a number
      // lets see if its in the 32bit range
      $ip4_hex=base_convert($hostname, 10, 16);
      if(strlen($ip4_hex)<=8){
        // ok, hex representation is less than 9 chars, so thats max FFFFFFFF
        return true;
      }
    }
    $ip_parts=Array();
    if(!preg_match('/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/',$hostname,$ip_parts)){
      return false;
    }
    // check if each block is in byte range (hard to test with regex)
    for($j=1;$j<=4;$j++){
      if(($ip_parts[$j]>255) || ($ip_parts[$j]<0)){
        return false;
      }
    }
    return true;
  }
580878
public function insert($tableName)
    {
        $sql = new Insert($tableName);
        $sql->setAdapter($this->_adapter);
        return $sql;
    }