Get third level domain like `www` from `www.example.com`.
@return string|NULL
776225
public function GetThirdLevelDomain () {
		if ($this->domainParts === NULL) $this->initDomainSegments();
		return isset($this->domainParts[0]) ? $this->domainParts[0] : NULL;
	}
1155171
public function getInternalDomains()
    {
        $domains = [$this->getDomainRegex(Yii::app()->request->getHostInfo())];
        if (Yii::app()->urlManager->urlFormat === 'path') {
            $parent = Yii::app()->urlManager instanceof \CUrlManager ? '\CUrlManager' : null;
            $rules = ReflectionHelper::readPrivateProperty(Yii::app()->urlManager, '_rules', $parent);
            foreach ($rules as $rule) {
                if ($rule->hasHostInfo === true) {
                    $domains[] = $this->getDomainRegex($rule->template, $rule->params);
                }
            }
        }
        return array_unique($domains);
    }
70232
private function getDomainLookupQuery($domain = null)
    {
        /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */
        $queryBuilder = $this->_em->createQueryBuilder();

        $queryBuilder->select(
            'domain.domain,
            primary.domain primaryDomain,
            language.iso639_2b languageId,
            site.siteId,
            country.iso3 countryId'
        )
            ->from(\Rcm\Entity\Domain::class, 'domain', 'domain.domain')
            ->leftJoin('domain.primaryDomain', 'primary')
            ->leftJoin('domain.defaultLanguage', 'language')
            ->leftJoin(
                \Rcm\Entity\Site::class,
                'site',
                Join::WITH,
                'site.domain = domain.domainId'
            )
            ->leftJoin('site.country', 'country');

        if (!empty($domain)) {
            $queryBuilder->andWhere('domain.domain = :domain')
                ->setParameter('domain', $domain);
        }

        return $queryBuilder->getQuery();
    }
151137
protected function defaultDomain()
    {
        if ($suffix = $this->parser->getDomainSuffix()) {
            return strtolower(camel_case(basename(getcwd()))) . '.' . $suffix;
        }
        return '';
    }
875116
public function getDomain()
    {
        $model = explode("\\", $this->getModelNamespace());
        return strlen($model[0]) || 1 === count($model) ? $model[0] : $model[1];
    }
1220533
public function getRegistrableDomain()
    {
        if (null === $this->suffix) {
            return null;
        }

        return null === $this->hostname ? null : $this->hostname . '.' . $this->suffix;
    }
1103109
protected function getDomain(?string $domain = null) : ?string
    {
        $domain = $domain ?? $this->appUrl;

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

        return $this->trim(str_replace(['http:', 'https:'], '', $domain), '/');
    }
1148194
public function getSocialNetworkFromDomain($url)
    {
        foreach ($this->getDefinitions() as $domain => $name) {

            if (preg_match('/(^|[\.\/])'.$domain.'([\.\/]|$)/', $url)) {

                return $name;
            }
        }

        return Piwik::translate('General_Unknown');
    }
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());
    }
1131096
public function getWebPath()
    {
        $webPath = $this->environment->getCurrentEnvironmentConfig()->get('Domain', false);
        if (!$webPath) {
            $webPath = Request::getInstance()->getCurrentUrl(true)->getDomain() . '/';
        }

        return $webPath;
    }
632833
public function getDomain()
    {
        $returnValue = null;
        if (is_null($this->domain)){
        	$this->domain = new core_kernel_classes_ContainerCollection(new common_Object(__METHOD__));
			$domainValues = $this->getPropertyValues($this->getProperty(OntologyRdfs::RDFS_DOMAIN));
			foreach ($domainValues as $domainValue){
				$this->domain->add($this->getClass($domainValue));
			}
		}
		$returnValue = $this->domain;
        

        return $returnValue;
    }
1075163
public function getSubstitutedDomain()
    {
        $currentHost = $_SERVER['HTTP_HOST'];

        // If there are wildcards in the primary domain (not recommended), make some
        // educated guesses about what to replace them with:
        $domain = preg_replace('/\.\*$/', ".{$currentHost}", $this->Domain);

        // Default to "subsite." prefix for first wildcard
        // TODO Whats the significance of "subsite" in this context?!
        $domain = preg_replace('/^\*\./', "subsite.", $domain);

        // *Only* removes "intermediate" subdomains, so 'subdomain.www.domain.com' becomes 'subdomain.domain.com'
        $domain = str_replace('.www.', '.', $domain);

        return $domain;
    }
284598
public function GetSecondLevelDomain () {
		if ($this->domainParts === NULL) $this->initDomainSegments();
		return isset($this->domainParts[1]) ? $this->domainParts[1] : NULL;
	}
1116897
public function getDomain(bool $withSuffix = true)
    {
        if (!isset($this->uri['host'])) {
            return null;
        }

        $manager = new Manager(new Cache(sys_get_temp_dir() . '/publicsuffix/'), new CurlHttpClient());
        $rules = $manager->getRules();
        $domain = $rules->resolve($this->uri['host']);

        if (!$domain->isKnown()) {
            return $this->uri['host'];
        }

        if ($withSuffix) {
            return $domain->getRegistrableDomain();
        } else {
            return substr($domain->getRegistrableDomain(), 0, -strlen($domain->getPublicSuffix()) - 1);
        }
    }
347777
public static function getDomainFromURL($url)
	{
		$url = str_replace(self::getProtocolFromURL($url) . '://', '', $url);
		
		return explode('/', $url)[0];
	}
839853
public function getCurrentDomain($default = null)
    {
        $currentDomain = PhpServer::getRequestDomain();

        //Use the default site if the requested domain name is an IP address
        $ipValidator = new Ip();
        if ($ipValidator->isValid($currentDomain)) {
            $currentDomain = $default;
        }

        return $currentDomain;
    }
1065971
public function getDomains()
    {
        if (0 === count($this->domains)) {
            return null;
        }

        return $this->domains->map(function(Domain $domain) {
            return $domain->getUrl();
        });
    }