检查验证域名是否匹配
@param Request $request
@param mixed $domain
@return boolean
431018
private function checkDomain(Request $request, $domain, &$params)
    {
        $params = [];
        if(Text::isEmpty($domain))
        {
            return true;
        }
        if(!is_array($domain))
        {
            $domain = [$domain];
        }
        foreach($domain as $rule)
        {
            $rule = $this->parseRule($rule, $fields);
            if(preg_match_all($rule, $request->getUri()->getDomain(), $matches) > 0)
            {
                $params = [];
                foreach($fields as $i => $fieldName)
                {
                    $params[$fieldName] = $matches[$i + 1][0];
                }
                return true;
            }
        }
        return false;
    }
501514
private function isTokenInRequest(Request $request)
    {
        return $request->query->has($this->tokenParam) ||
            $request->attributes->has($this->tokenParam) ||
            $request->request->has($this->tokenParam);
    }
416704
public function resolve(Request $request)
    {
        //locale
        switch ($this->localePattern) {
            case self::PATTERN_DOMAIN:
                $locale = $this->resolveFromDomain($request);
                $request->setLocale($locale);
                break;
        }

        return $request->getLocale();
    }
718160
protected function ensureLoaded( $domain, $lang ) {
		if ( isset( $this->loadedDomains[ $domain ][ $lang ] ) ) {
			// Already tried
			return $this->loadedDomains[ $domain ][ $lang ];
		}

		// Validate input and protect against path traversal
		if ( !IntuitionUtil::nonEmptyStrs( $domain, $lang ) ||
			strcspn( $domain, ":/\\\000" ) !== strlen( $domain ) ||
			strcspn( $lang, ":/\\\000" ) !== strlen( $lang )
		) {
			$this->errTrigger( 'Illegal domain or lang', __METHOD__, E_NOTICE );
			return false;
		}

		$this->loadedDomains[ $domain ][ $lang ] = false;

		if ( !isset( self::$messageCache[ $domain ][ $lang ] ) ) {
			// Load from disk
			$domainInfo = $this->getDomainInfo( $domain );
			if ( !$domainInfo ) {
				// Unknown domain. Perhaps dev-mode only with
				// messages provided via setMsgs()?
				return false;
			}
			$file = $domainInfo['dir'] . "/$lang.json";
			$this->loadMessageFile( $domain, $lang, $file );
		} else {
			// Load from static cache, e.g. from a previous instance of this class
			$this->setMsgs( self::$messageCache[ $domain ][ $lang ], $domain, $lang );
		}

		$this->loadedDomains[ $domain ][ $lang ] = true;
		return true;
	}
1239369
public function isAuthenticated(Request $request): bool
    {
        foreach ($this->authentications as $authentication) {
            if ($authentication->isAuthenticated($request)) {
                return true;
            }
        }

        return false;
    }
359115
public function validate(Request $request)
    {
        return ! \is_null($this->domain) && $request->getHost() === $this->getStrippedDomain();
    }
677292
public static function detectLanguageFromRequest(Request $request)
    {
        $splitURL = explode("/", $request->path());
        if(isset($splitURL[0])) {
            // validate language
            if(self::findBySlug($splitURL[0])) {
                return $splitURL[0];
            }
        }
        return false;
    }
52210
public function validationDomain($domain = null)
    {
        if ($domain === null) {
            return $this->_validationDomain;
        }
        $this->_validationDomain = $domain;
    }
294259
public function getCookie($key, $domain = '-')
    {
        $domain = strtolower($domain);
        if ($key === null) {
            $cookies = [];
        }
        while (true) {
            if (isset($this->_cookies[$domain])) {
                foreach ($this->_cookies[$domain] as $path => $list) {
                    if ($key === null) {
                        $cookies = array_merge($list, $cookies);
                    } else {
                        if (isset($list[$key])) {
                            return rawurldecode($list[$key]['value']);
                        }
                    }
                }
            }
            if (($pos = strpos($domain, '.', 1)) === false) {
                break;
            }
            $domain = substr($domain, $pos);
        }
        return $key === null ? $cookies : null;
    }
562937
public static function isValidDomain($domain)
    {
        $valid = mb_strlen($domain, 'UTF-8') <= self::PHP_IDN_HANDLEABLE_LENGTH;

        if ($valid) {
            $result = idn_to_ascii(
                $domain,
                IDNA_USE_STD3_RULES | IDNA_NONTRANSITIONAL_TO_ASCII,
                INTL_IDNA_VARIANT_UTS46
            );

            if (!is_string($result)) {
                $valid = false;
            }
        }
        
        if ($valid) {
            $domainNameLength = strlen($result);
            if ($domainNameLength < 1 || $domainNameLength > 253) {
                $valid = false;
            }
        }
        
        if ($valid) {
            foreach (explode('.', $result) as $label) {
                $labelLength = strlen($label);
                if ($labelLength < 1 || $labelLength > 63) {
                    $valid = false;
                    break;
                }
            }
        }
        
        if ($valid) {
            $result = idn_to_utf8($result, IDNA_USE_STD3_RULES, INTL_IDNA_VARIANT_UTS46, $idna_info);
            if ($idna_info['errors'] !== 0) {
                $valid = false;
            }
        }
        
        return $valid;
    }
983820
public function route(Request &$request)
	{
		$matcher = $this->routerContainer->getMatcher();
		$route = $matcher->match($request);
		if (!$route) {
			return false;
		}

		foreach ($route->extras as $key => $val) {
			$request = $request->withAttribute($key, $val);
		}
		foreach ($route->attributes as $key => $val) {
			$request = $request->withAttribute($key, $val);
		}
		$request = $request->withAttribute('route.name', $route->name);

		return $route->handler;
	}
619942
public function validate(Request $request)
    {
        $this->validateUsername($request);
        $this->validatePassword($request);
        $this->validateEmail($request);
        $this->validateGender($request);

        return $this->isValid;
    }
1325224
public function verify(string $domain)
    {
        Assert::stringNotEmpty($domain);

        $response = $this->httpPut(sprintf('/v3/domains/%s/verify', $domain));

        return $this->hydrateResponse($response, VerifyResponse::class);
    }
73174
public static function domainToUnicode($domain)
    {
        return mb_strlen($domain, 'UTF-8') <= self::PHP_IDN_HANDLEABLE_LENGTH
            ? idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46)
            : false;
    }
548030
protected function checkDomain()
    {
        // 获取当前子域名
        $subDomain = $this->getSubDomain();

        $item = false;

        if ($subDomain && count($this->domains) > 1) {
            $domain = explode('.', $subDomain);
            $domain2 = array_pop($domain);

            if ($domain) {
                // 存在三级域名
                $domain3 = array_pop($domain);
            }

            if ($subDomain && isset($this->domains[$subDomain])) {
                // 子域名配置
                $item = $this->domains[$subDomain];
            } elseif (isset($this->domains['*.' . $domain2]) && !empty($domain3)) {
                // 泛三级域名
                $item = $this->domains['*.' . $domain2];
                $panDomain = $domain3;
            } elseif (isset($this->domains['*']) && !empty($domain2)) {
                // 泛二级域名
                if ('www' != $domain2) {
                    $item = $this->domains['*'];
                    $panDomain = $domain2;
                }
            }

            if (isset($panDomain)) {
                // 保存当前泛域名
                $this->request->setPanDomain($panDomain);
            }
        }

        if (false === $item) {
            // 检测当前完整域名
            $item = $this->domains[$this->host];
        }

        if (is_string($item)) {
            $item = $this->domains[$item];
        }

        return $item;
    }
1094412
private function matchesDomain(string $requestDomain, string $cookieDomain): bool {
        if ($requestDomain === \ltrim($cookieDomain, ".")) {
            return true;
        }

        if (!($isWildcardCookieDomain = ($cookieDomain[0] === '.'))) {
            return false;
        }

        if (filter_var($requestDomain, FILTER_VALIDATE_IP)) {
            return false;
        }

        if (substr($requestDomain, 0, -\strlen($cookieDomain)) . $cookieDomain === $requestDomain) {
            return true;
        }

        return false;
    }
990272
private function get_server($domain='')
    {
        if(Request::isHttps()){
            $prefix='https://';
        }else{
            $prefix='http://';
        }
        $c=Config::get('is_simple_url');
        if($domain==''){
            $domain=get_domain();
        }
        return $prefix.$domain;
    }