Set the domain name with HTTP protocol
@param string $domain
@param string $protocol
@return sFire\Router\Forward
494357
public function domain($domain, $protocol = null) {

		if(false === is_string($domain)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
		}

		//Check if identifier exists
		if(false === Router :: routeExists($this -> identifier, $domain)) {
			return trigger_error(sprintf('Identifier "%s" with domain "%s" does not exists', $this -> identifier, $domain), E_USER_ERROR);	
		}

		if(null !== $protocol && false === is_string($protocol)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($protocol)), E_USER_ERROR);
		}

		if(null === $protocol) {
			$protocol = Request :: getScheme();
		}

		$this -> domain = sprintf('%s://%s', $protocol, $domain);

		return $this;
	}
458629
protected function resolveTenantRoutes($domain)
    {
        if (null === $dt = $this->repository->findOneByDomain($domain)) {
            return $this->error(
                sprintf('No tenant found for "%s", are you sure you entered the correct domain?', $domain)
            );
        }

        /** @var Tenant $tenant */
        $tenant = app('auth.tenant');
        $tenant->updateTenancy(new NullUser(), $dt->getTenantOwner(), $dt);

        $this->resolver->boot($this->router);
        return $this->routes = $this->router->getRoutes();
    }
558797
public function cancelDomainAction(\Transip\Model\Domain $domain)
    {
        return $this->getSoapClient(array_merge(array($domain), array('__method' => 'cancelDomainAction')))->cancelDomainAction($domain);
    }
590374
protected function stripPort($domain)
    {
        if ($domainStripped = \preg_replace(self::PATTERN_STRIP_PROTOCOL, null, $domain)) {
            return $domainStripped;
        }

        return $domain;
    }
241223
public function connect($host,$domain)
    {
        $remoteSocket = $host . ':' . $this->config['port'];
        $this->domain = $domain;
        $errnum       = 0;
        $errstr       = '';
        $this->host   = $remoteSocket;
        // open connection

        $this->socket = @stream_socket_client(
            $this->host,
            $errnum,
            $errstr,
            $this->timeout,
            STREAM_CLIENT_CONNECT,
            stream_context_create($this->validationOptions['context'])
        );

        // connected?
        if (!$this->isConnect()) {
            return 'no connection';
        }

        $result = stream_set_timeout($this->socket, $this->timeout);

        if (!$result) {
            return 'Cannot set timeout';
        }
        return 'connected';
    }
799512
public function addPreinitDomain($domain) {
		$domain = (string) $domain;
		
		if (in_array($domain, $this->preinitDomains, true)) {
			return $this;
		}
		
		$this->preinitDomains[] = $domain;
		$this->preinitNeed      = true;
		
		return $this;
	}
1173210
public function setDomain($domain)
    {
        try {
            $this->domain = (string) $domain;
        } catch (Exception $e) {
            throw new InvalidArgumentException(
                'Value provided as domain is not a string'
            );
        }

        return $this;
    }
428880
public function setPrefix(string $prefix) : RouterInterface {
        $prefix = trim($prefix, '/');
        $this->prefix = $prefix.(strlen($prefix) ? '/' : '');
        return $this;
    }
1326458
public function route($name, $domain = null)
    {
        $this->routes[$name] = clone $this->protoRoute;
        $this->routes[$name]->name($name);
        if (isset($domain)) {
            $this->routes[$name]->domain($domain);
        }
        return $this->routes[$name];
    }
349193
public function allowOrigin($domain)
    {
        $allowed = $this->_normalizeDomains((array)$domain);
        foreach ($allowed as $domain) {
            if (!preg_match($domain['preg'], $this->_origin)) {
                continue;
            }
            $value = $domain['original'] === '*' ? '*' : $this->_origin;
            $this->_headers['Access-Control-Allow-Origin'] = $value;
            break;
        }

        return $this;
    }
943058
public function withProtocolVersion($version)
    {
        if (!is_string($version)) {
            throw new \InvalidArgumentException("Expected protocol version to be a string");
        }
        
        $this->protocolVersion = $version;
        
        $this->sendStatusHeader();
        
        return $this;
    }
927976
public function setURL($server, $root, $url, $protocol=null) {
		$this->url = new \Asgard\Http\URL($this, $server, $root, $url, $protocol);

		preg_match('/\.([a-zA-Z0-9]{1,5})$/', $this->url->get(), $matches);
		if(isset($matches[1]))
			$this->setParam('format', $matches[1]);
		return $this;
	}
1153331
public static function isDomain($domain)
    {
        if (!is_string($domain)) {
            throw new \ErrorException('Accept string ' . gettype($domain) . ' given');
        }

        return  (bool) preg_match(
            '/^((https?|ftps?|ssl|url|git):\/\/)?[a-zA-Z0-9-_.]+\.[a-z]{2,6}$/',
            $domain
        );
    }
170261
public function setDomain(string $domain = '', bool $forSubdomains = true): void
    {
        $subdomainIndicator = $forSubdomains === true ? '.' : '';
        $this->domain = \sprintf('%s%s', $subdomainIndicator, \preg_replace('/^(\.)?(preview\.)?/', '', $domain));
    }
810974
public function createPair($domain, $type, $protocol)
    {
        $ret = @socket_create_pair($domain, $type, $protocol, $pair);
        if ($ret === false) {
            throw Exception::createFromGlobalSocketOperation('Unable to create pair of sockets');
        }
        return array(new Socket($pair[0]), new Socket($pair[1]));
    }
490755
public function changeWebDomain($domain, $ftpUserName, $ftpPath)
    {
        return $this->send('v-change-web-domain-ftp-path', $this->userName, $domain, $ftpUserName,
            $ftpPath);
    }
606588
public function setDomainUrl($domainUrl = '')
    {
        $this->domainUrl = $domainUrl;
        $this->debug->debug(__FUNCTION__, 'setDomainUrl: ' . json_encode($this->domainUrl));

        return $this;
    }