The domain to ASCII given a domain $domain.
@link https://url.spec.whatwg.org/#concept-domain-to-ascii URL Standard
@param string $domain A UTF-8 string.
@return string|false
545529
public static function domainToASCII($domain)
    {
        return mb_strlen($domain, 'UTF-8') <= self::PHP_IDN_HANDLEABLE_LENGTH
            ? idn_to_ascii($domain, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)
            : false;
    }
1170896
public static function toAscii($string)
    {
        $string = explode('@', $string);

        // Not addressing UTF-8 user names
        $new = $string[0];

        if (!empty($string[1])) {
            $domainExploded = explode('.', $string[1]);
            $newdomain      = '';

            foreach ($domainExploded as $domainex) {
                $domainex  = static::encode($domainex);
                $newdomain .= $domainex . '.';
            }

            $newdomain = substr($newdomain, 0, -1);
            $new       = $new . '@' . $newdomain;
        }

        return $new;
    }
1333211
protected function validateDomainName($domain)
    {
        if (!array_key_exists($domain, $this->domains)) {
            throw new InvalidArgumentException(sprintf(
                'Domain "%s" is not valid. Valid domains are: %s',
                $domain,
                implode(', ', array_keys($this->domains))
            ));
        }
    }
862400
public static function getNonSequenceDomain(string $domain) : string {
		if (strpos($domain, '_sequence') !== false) {
			return str_replace('_sequence', '', $domain);
		}
		return $domain;
	}
1316163
public function domain($domain = null) {
        if (!is_null($domain)) {
            $this->domain = $domain;
            return $this;
        } elseif (!$this->domain) {
            $this->domain = $this->scheme() . '://' . $this->host();
        }
        return $this->domain;
    }
1248495
public function domain($domain = null)
    {
        if (is_null($domain)) {
            return $this->getDomain();
        }

        $this->action['domain'] = $domain;

        return $this;
    }
1202499
protected function _normalizeDomains($domains)
    {
        $result = [];
        foreach ($domains as $domain) {
            if ($domain === '*') {
                $result[] = ['preg' => '@.@', 'original' => '*'];
                continue;
            }

            $original = $preg = $domain;
            if (strpos($domain, '://') === false) {
                $preg = ($this->_isSsl ? 'https://' : 'http://') . $domain;
            }
            $preg = '@^' . str_replace('\*', '.*', preg_quote($preg, '@')) . '$@';
            $result[] = compact('original', 'preg');
        }

        return $result;
    }
501259
public function getReason($domain)
    {
        $domaincdNode = $this->getDomaincd($domain);
        $node = $this->getFirst('domain:reason', $domaincdNode);

        return $node === null ? null : $node->nodeValue;
    }
342218
protected function getDomaincd($domain)
    {
        $pattern = '//epp:epp/epp:response/epp:resData/domain:chkData/domain:cd[domain:name[php:functionString("XPath\quote", text()) = \'%s\']]';
        $query = sprintf($pattern, XPath\quote($domain));
        $node = $this->getFirst($query);

        if ($node === null) {
            throw new UnexpectedValueException(sprintf('Domain with name [%s] not found.', $domain));
        }

        return $node;
    }
1022719
public static function encodeDomainName($domain): string
    {
        if ('.' === $domain) {
            return chr(0);
        }

        $domain = rtrim($domain, '.').'.';
        $res = '';

        foreach (explode('.', $domain) as $label) {
            $res .= chr(strlen($label)).$label;
        }

        return $res;
    }
192459
public static function isTypoInDomain(string $domain): bool
    {
        if (self::$domainsTypo === null) {
            self::$domainsTypo = self::getData('domainsTypo');
        }

        if (\in_array($domain, self::$domainsTypo, true)) {
            return true;
        }

        return false;
    }
63640
public function setDomainName($domain)
    {
        $domain = strtolower($domain);
        if (!$this->getDomainValidator()->isValid($domain)) {
            throw new InvalidArgumentException(
                'Domain name is invalid: ' . $domain
            );
        }

        $this->domain = $domain;
    }
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;
	}
429492
protected function getTranslations( $domain )
	{
		if( !isset( $this->files[$domain] ) )
		{
			if ( !isset( $this->sources[$domain] ) )
			{
				$msg = sprintf( 'No translation directory for domain "%1$s" available', $domain );
				throw new \Aimeos\MW\Translation\Exception( $msg );
			}

			// Reverse locations so the former gets not overwritten by the later
			$locations = array_reverse( $this->getTranslationFileLocations( $this->sources[$domain], $this->getLocale() ) );

			foreach( $locations as $location ) {
				$this->files[$domain][$location] = new \Aimeos\MW\Translation\File\Mo( $location );
			}
		}

		return ( isset( $this->files[$domain] ) ? $this->files[$domain] : [] );
	}
792218
protected function getValue($string, $domain, $locale)
    {
        if (!$domain) {
            $domain = 'default';
        }

        if (!$locale) {
            $locale = 'default';
        }

        if (!isset($this->values[$locale][$domain][$string])) {
            return $string;
        }

        return $this->values[$locale][$domain][$string];
    }
1059726
public function queryServer($domain, $server = false)
    {
        $domain = strtolower($domain);

        if (!$server) {
            $server = $this->getWhoisServer($domain);
        }

        if (!$this->socket->connect($server, self::WHOIS_PORT)) {
            return false;
        }

        // @todo This shouldn't be hard coded
        if ($server == 'whois.verisign-grs.com') {
            $domain = '=' . $domain;
        }

        $this->socket->write($domain . "\r\n");

        $result = '';

        while (!$this->socket->closed()) {
            $result .= $this->socket->read();
        }

        $this->socket->disconnect();

        return $result;
    }
81537
private function toASCII($string)
    {
        $ascii = "";

        for ($i = 0; $i < strlen($string); $i ++) {
            $ascii .= '\x' . bin2hex($string{$i});
        }

        return $ascii;
    }