Resolves schema and host name with dir from passed basename

@param string $host

@return array
494279
protected function resolveHost($host)
    {
        if (strpos($host, '://') !== false) {
            list($schema, $host) = explode('://', $host, 2);
        }

        if ($this->schema) {
            $schema = $this->schema;
        }

        if (empty($schema)) {
            $schema = 'http';
        }

        return array($schema, $host);
    }
735095
private function checkHost(string $host): bool
    {
        return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
    }
936999
public function getReason($host)
    {
        $hostcdNode = $this->getHostcd($host);
        $node = $this->getFirst('host:reason', $hostcdNode);

        return $node === null ? null : $node->nodeValue;
    }
799189
public function setHost($host)
    {
        if ($host instanceof $this->hostClass || $host instanceof \yii\web\IdentityInterface) {
            return $this->{$this->createdByAttribute} = $host->getGUID();
        }
        if (is_string($host) && preg_match(Number::GUID_REGEX, $host)) {
            return $this->{$this->createdByAttribute} = Number::guid_bin($host);
        }
        if (strlen($host) == 16) {
            return $this->{$this->createdByAttribute} = $host;
        }
        return false;
    }
800081
public function setHost($host)
    {
        if (substr($host, -1) === '/') {
            $host = substr($host, 0, -1);
        }

        $headers = $this->getConfig('headers');
        $headers['Host'] = $host;
        $this->setConfigOption('headers', $headers);

        if (strpos('/', $host) === false) {
            $host = 'https://' . $host;
        }
        $this->setConfigOption('base_uri', $host);

        return $this;
    }
960609
public function hasHost($host)
    {
        $this->processFile($this->getFile());

        return array_key_exists($host, $this->hosts);
    }
25423
public function getRootNode($host = null)
    {
        if (!$this->isMultiDomainHost()) {
            return parent::getRootNode();
        }

        if (is_null($this->rootNode)) {
            $host = $this->getRealHost($host);

            $internalName = $this->hosts[$host]['root'];
            $nodeRepo = $this->em->getRepository('KunstmaanNodeBundle:Node');
            $this->rootNode = $nodeRepo->getNodeByInternalName($internalName);
        }

        return $this->rootNode;
    }
411479
public function setHost($host)
    {
        if ($this->validateHost($host) === false) {
            throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host");
        }

        $oldHost     = $this->_host;
        $this->_host = $host;

        return $oldHost;
    }
915587
protected function getSiteAliases($site) {
    /** @var \AcquiaCloudApi\Response\ApplicationResponse $site */
    $aliases = [];
    $sites = [];
    $this->output->writeln("<info>Gathering sites list from Acquia Cloud.</info>");

    $environments = $this->cloudApiClient->environments($site->uuid);
    $hosting = $site->hosting->type;
    $site_split = explode(':', $site->hosting->id);

    foreach ($environments as $env) {
      $domains = [];
      $domains = $env->domains;
      $this->say('<info>Found ' . count($domains) . ' sites for environment ' . $env->name . ', writing aliases...</info>');

      $sshFull = $env->sshUrl;
      $ssh_split = explode('@', $env->sshUrl);
      $envName = $env->name;
      $remoteHost = $ssh_split[1];
      $remoteUser = $ssh_split[0];

      if ($hosting == 'ace') {

        $siteID = $site_split[1];
        $uri = $env->domains[0];
        $sites[$siteID][$envName] = ['uri' => $uri];
        $siteAlias = $this->getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID);
        $sites[$siteID][$envName] = $siteAlias[$envName];

      }

      if ($hosting == 'acsf') {
        $this->say('<info>ACSF project detected - generating sites data....</info>');

        try {
          $acsf_sites = $this->getSitesJson($sshFull, $remoteUser);
        }
        catch (\Exception $e) {
          $this->logger->error("Could not fetch acsf data for $envName. Error: " . $e->getMessage());
        }

        // Look for list of sites and loop over it.
        if ($acsf_sites) {
          foreach ($acsf_sites['sites'] as $name => $info) {

            // Reset uri value to identify non-primary domains.
            $uri = NULL;

            // Get site prefix from main domain.
            if (strpos($name, '.acsitefactory.com')) {
              $acsf_site_name = explode('.', $name, 2);
              $siteID = $acsf_site_name[0];
            }
            if (!empty($siteID) && !empty($info['flags']['preferred_domain'])) {
              $uri = $name;
            }

            foreach ($domains as $site) {
              // Skip sites without primary domain as the alias will be invalid.
              if (isset($uri)) {
                $sites[$siteID][$envName] = ['uri' => $uri];
                $siteAlias = $this->getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID);
                $sites[$siteID][$envName] = $siteAlias[$envName];
              } continue;
            }
          }

        }
      }

    }

    // Write the alias files to disk.
    foreach ($sites as $siteID => $aliases) {
      $this->writeSiteAliases($siteID, $aliases);

    }
  }
824367
public function getLink(string $host = null): ?Link
    {
        // link exists?
        // e.g: getLink('localhost')
        if ($host && isset($this->links[$host])) {
            return $this->links[$host];
        }

        $host = trim((string) $host);
        // with master/slave directives
        if (true === $this->config->get('sharding')) {
            // e.g: getLink(), getLink('master'), getLink('master.mysql.local')
            if ($host == '' || $host == Link::TYPE_MASTER) {
                return Util::arrayRand(
                    array_filter($this->links, function($link) {
                        return $link->getType() == Link::TYPE_MASTER;
                }));
            }
            // e.g: getLink(), getLink('slave'), getLink('slave1.mysql.local')
            elseif ($host == Link::TYPE_SLAVE) {
                return Util::arrayRand(
                    array_filter($this->links, function($link) {
                        return $link->getType() == Link::TYPE_SLAVE;
                }));
            }
        } else {
            // e.g: getLink()
            if ($host == '') {
                return Util::arrayRand(
                    array_filter($this->links, function($link) {
                        return $link->getType() == Link::TYPE_SINGLE;
                }));
            }
        }
    }
436150
public function getBackendLocales($host = null)
    {
        $host = $this->getRealHost($host);

        if (isset($this->hosts[$host]['locales'])) {
            return array_values($this->hosts[$host]['locales']);
        }

        return parent::getBackendLocales();
    }
331313
protected function getHosts($host = null): array
    {
        $host = $host ?? config('varnish.host');

        if (! is_array($host)) {
            $host = [$host];
        }

        return $host;
    }
306620
public function findFor(string $filename, $host) : array
    {
        foreach ($this->normalizedDocProviderList as $provider) {
            if (true === $provider->supports($filename, $host)) {
                return $provider->getDoc($host);
            }
        }

        throw new \Exception(sprintf('No documentation provider found for "%s"/"%s"', $filename, $host));
    }
570294
public function setHost($host)
    {
        if (preg_match(self::PATTERN_MATCH_HOST, $host) !== 1) {
            throw new \InvalidArgumentException('"' . $host . '" is not valid host as part of a URI.', 1184071240);
        }

        $this->host = $host;
    }
990706
private static function getHostAndPortFromHost($host): array
    {
        if (\is_array($host)) {
            $host = \implode(', ', $host);
        }

        $port = null;

        // works for regname, IPv4 & IPv6
        if (\preg_match('|\:(\d+)$|', $host, $matches)) {
            $host = \substr($host, 0, -1 * (\strlen($matches[1]) + 1));
            $port = (int) $matches[1];
        }

        return [$host, $port];
    }
881844
public function setHost($host)
    {
        if (strpos($host, ':') === false) {
            $this->host = $host;
        } else {
            list($host, $port) = explode(':', $host);
            $this->host = $host;
            $this->setPort($port);
        }

        return $this;
    }
447022
public static function setHost($host) {
        $host = rtrim($host, '/');
        if(!filter_var($host, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException("'$host' is not a valid URL");
        }
        self::$host = $host;
    }