Set second level domain like `example` in `www.example.com`.
Method also change server name and host record automatically.
@param string|NULL $secondLevelDomain
@return \MvcCore\Request|\MvcCore\IRequest
769097
public function & SetSecondLevelDomain ($secondLevelDomain) {
		/** @var $this \MvcCore\Request */
		if ($this->domainParts === NULL) $this->initDomainSegments();
		$this->domainParts[1] = $secondLevelDomain;
		$this->hostName = trim(implode('.', $this->domainParts), '.');
		if ($this->hostName && $this->portDefined) 
			$this->host = $this->hostName . ':' . $this->port;
		$this->domainUrl = NULL;
		$this->baseUrl = NULL;
		$this->requestUrl = NULL;
		$this->fullUrl = NULL;
		return $this;
	}
1157350
private static function retrieveDomainPrefix(int $mainDomainLevel): string
    {
        $host  = $_SERVER['HTTP_HOST'];
        $parts = explode('.', $host);
        for ($i = 0; $i < $mainDomainLevel; $i++) {
            array_pop($parts);
        }

        return implode('.', $parts);
    }
52210
public function validationDomain($domain = null)
    {
        if ($domain === null) {
            return $this->_validationDomain;
        }
        $this->_validationDomain = $domain;
    }
839800
protected function getPrimaryDomain($domain)
    {
        /** @var \Rcm\Entity\Domain $domain */
        $domain = $this->_em->getRepository(\Rcm\Entity\Domain::class)
            ->findOneBy(['domain' => $domain]);

        if (empty($domain)) {
            return null;
        }

        $primary = $domain->getPrimary();

        if (!$primary->getPrimary()) {
            return $primary;
        }

        return $this->getPrimaryDomain($primary->getDomainName());
    }
700069
public function twiceDaily($first = 1, $second = 13)
    {
        $hours = $first.','.$second;

        return $this->spliceIntoPosition(1, 0)
                    ->spliceIntoPosition(2, $hours);
    }
854210
public function setDomain(Domain $domain)
    {
        $this->domain = $domain;
        $this->domainId = $domain->getDomainId();
    }
1341344
public function addLink($name1, $name2, ...$domain)
    {
        if (1 == \count($domain)) {
            $name1 = $domain[0].'::'.$name1;
            $name2 = $domain[0].'::'.$name2;
        } elseif (\count($domain) > 1) {
            throw new CasbinException('error: domain should be 1 parameter');
        }

        $role1 = $this->createRole($name1);
        $role2 = $this->createRole($name2);
        $role1->addRole($role2);
    }
1238422
private static function secondDomainFilter($requestUrlArr) {
        $domain = Domain::checkSecondDomain();
        if ($domain) {
            if (empty($requestUrlArr[0])) {
                $requestUrlArr[0] = $domain;
            } else {
                array_unshift($requestUrlArr, $domain);
            }
        }
        return $requestUrlArr;
    }
236896
public function setLabel($label, $domain = null)
    {
        $this->label = $label;
        $this->setDomain($domain);

        return $this;
    }
799531
public function on($first, $second)
    {
        return $this->raw(
            $this->builder->adapter()->quote($first) 
            . ' = ' .
            $this->builder->adapter()->quote($second)
        );
    }
1078777
static public function GetRootDomain($domain=null) 
	{
	    $domain = !empty($domain) ? $domain : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
	    if (!$domain) {
	        return 'localhost';
	    }
	    
	    $re_domain = '';
	    $domain_postfix_cn_array = array("com", "net", "org", "gov", "edu", "com.cn", "net.cn", "cn");
	    $array_domain = explode(".", $domain);
	    $array_num = count($array_domain) - 1;
	    if ($array_domain[$array_num] == 'cn') {
	        if (in_array($array_domain[$array_num - 1], $domain_postfix_cn_array)) {
	            $re_domain = $array_domain[$array_num - 2] . "." . $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	        } else {
	            $re_domain = $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	        }
	    } else {
	        $re_domain = $array_domain[$array_num - 1] . "." . $array_domain[$array_num];
	    }
	    return $re_domain;
	}
1150737
public function set( $domain, $node = NULL, $resource = NULL ){
		if( !strlen( trim( $domain ) ) )
			throw new InvalidArgumentException( 'Domain is missing' );
		$this->domain	= $domain;
		$this->node		= $node;
		$this->resource	= $resource;
	}
739842
public function setDomain($domain = self::DEFAULT_DOMAIN)
    {
        $this->domain = $domain;
        if (isset($this->config[$this->domain]) && !empty($this->config[$this->domain])) {
            $this->codes = $this->config[$this->domain];
        } else {
            $this->codes  = $this->config[self::DEFAULT_DOMAIN];
            $this->domain = self::DEFAULT_DOMAIN;
        }
        return $this;
    }
100974
public function setLevel(string $level)
    {
        if (!defined(LogLevel::class . '::' . strtoupper($level)))
            throw new \DomainException("Invalid log level: $level");

        $this->level = $level;
        $this->level_num = self::$LEVEL_NUMERIC[$level];
        return $this;
    }
776225
public function GetThirdLevelDomain () {
		if ($this->domainParts === NULL) $this->initDomainSegments();
		return isset($this->domainParts[0]) ? $this->domainParts[0] : NULL;
	}
1100642
public function setDomain($domain) {
        if(!$this->setModified('domain', $domain)->isModified()) {
            return $this;
        }
        $this->domain = $domain;
        return $this;
    }
653020
public function levenshtein($first, $second)
    {
        $l = new \Atomescrochus\StringSimilarities\Levenshtein();

        return $l->compare($first, $second);
    }