Sets (and adds if necessary) the primary domain of this site.

@param Domain|null $domain The domain
@return void
@api
435944
public function setPrimaryDomain(Domain $domain = null)
    {
        if ($domain === null) {
            $this->primaryDomain = null;
            return;
        }

        if (!$domain->getActive()) {
            return;
        }

        $this->primaryDomain = $domain;
        if (!$this->domains->contains($domain)) {
            $this->domains->add($domain);
        }
    }
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;
	}
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), '/');
    }
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;
	}
613031
static public function getSecondDomain($domain=null)
	{
	    $domain = !empty($domain) ? $domain : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
	    $n = preg_match('/([^.]*\.)?([^.]*\.)?\w+\.\w+$/', $domain, $matches);
	    return $domain && isset($matches[2]) ? $matches[2] : (isset($matches[1]) ? $matches[1] : '');
	}
676892
public function setMainPhone($entity)
    {
        // set main to first entry or to null
        if ($entity->getPhones()->isEmpty()) {
            $entity->setMainPhone(null);
        } else {
            $entity->setMainPhone($entity->getPhones()->first()->getPhone());
        }
    }
602588
public void setDomains(java.util.Collection<String> domains) {
        if (domains == null) {
            this.domains = null;
            return;
        }

        this.domains = new java.util.ArrayList<String>(domains);
    }
37718
public function bind($bind, $domain = null)
    {
        $domain = is_null($domain) ? $this->domain : $domain;

        $this->bind[$domain] = $bind;

        return $this;
    }
819231
public void setDomain(Annotation v) {
    if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_domain == null)
      jcasType.jcas.throwFeatMissing("domain", "de.julielab.jules.types.OntRelationMention");
    jcasType.ll_cas.ll_setRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_domain, jcasType.ll_cas.ll_getFSRef(v));}
864619
public function store($data, $domain)
	{
		$messages   = (array) $this->retrieve($domain);
		$messages[] = $data;

		$this->messages[$this->key($domain)] = $messages;
	}
192297
public function setDomain( $domain )
	{
		if ( $domain == $this->getDomain() ) { return; }

		$this->_values['domain'] = (string) $domain;
		$this->setModified();
	}
217514
public function setPrimaryDomain($primaryDomain)
    {
        if (empty($primaryDomain)) {
            $this->primaryDomain = null;
            $this->primaryId = null;

            return;
        }

        $this->primaryDomain = $primaryDomain;
        $this->primaryId = $primaryDomain->getDomainId();
    }
883028
private function setMainUrl(Url $url)
    {
        if (null !== $this->mainUrl) {
            $this->mainUrl->setMain(false);
        }

        $this->mainUrl = $url;
        $this->mainUrl->setMain(true);
    }
462875
public function setDefaultPathAndDomain($path, $domain)
    {
        list($this->path, $this->domain) = array($path, $domain);

        return $this;
    }
848957
public function newDomainAction(Domain $domain = null, Site $site = null)
    {
        $this->view->assignMultiple([
            'domain' => $domain,
            'site' => $site,
            'schemes' => [null => '', 'http' => 'HTTP', 'https' => 'HTTPS']
        ]);
    }
103112
public function domain($domain = null)
    {
        deprecationWarning('Email::domain() is deprecated. Use Email::setDomain() or Email::getDomain() instead.');

        if ($domain === null) {
            return $this->getDomain();
        }

        return $this->setDomain($domain);
    }
1061660
public function addTextDomain($domain, $path): void
    {
        // check path
        if (!is_dir($path)) {
            throw new ConfigurationException("Translator configuration path `$path` not found");
        }

        bindtextdomain($domain, $path);

        // @todo: hardcoded codeset
        bind_textdomain_codeset($domain, 'UTF-8');
    }