The domain the cookie is visible to. Defaults to the current browsing context's document's URL domain if omitted.

@param string $domain
515551
public function setDomain($domain)
    {
        if (mb_strpos($domain, ':') !== false) {
            throw new InvalidArgumentException(sprintf('Cookie domain "%s" should not contain a port', $domain));
        }

        $this->cookie['domain'] = $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;
	}
890366
public function updateDomainAction(Domain $domain)
    {
        $this->domainRepository->update($domain);
        $this->addFlashMessage('The domain "%s" has been updated.', 'Domain updated', Message::SEVERITY_OK, [htmlspecialchars($domain)], 1412373069);
        $this->unsetLastVisitedNodeAndRedirect('edit', null, null, ['site' => $domain->getSite()]);
    }
862887
protected function _matchDomain($domain) 
    {
        $ret = array();

        foreach (array_keys($this->cookies) as $cdom) {
            $regex = "/" . preg_quote($cdom, "/") . "$/i";
            if (preg_match($regex, $domain)) { $ret[$cdom] = &$this->cookies[$cdom];
            }
        }

        return $ret;
    }
571494
public function startSession($domain) {
        $this->cookieLocation = str_replace('APP_ROOT', APP_ROOT, $this->cookieLocation);
        if (!is_dir($this->cookieLocation))
            mkdir($this->cookieLocation);
        if (!is_dir($this->cookieLocation)) {
            $this->error($this->error = "Can't create folder {$this->cookieLocation}");
        }
        $this->currentFile = $this->cookieLocation . date('YmdHis') . '-' . md5($domain);
        fclose(fopen($this->currentFile, 'w'));
    }
279225
public function copy(Domain $domain)
    {
        $this->defaultValue = $domain->getDefaultValue();
        $this->description = $domain->getDescription();
        $this->name = $domain->getName();
        $this->scale = $domain->getScale();
        $this->size = $domain->getSize();
        $this->sqlType = $domain->getSqlType();
        $this->propelType = $domain->getType();
    }
603173
public function GetCookies($domain)
	{
		$sig = $this->encode($this->applicationSecret."|".$domain);

		$qs = "key=" .urlencode($this->applicationKey)."&domain=".urlencode($domain)."&sig=".$sig;

		$obj = $this->getResultObject($this->Get($this->getRootUrl(false) . "getcookies.ashx?" . $qs));

		$result = array();

		foreach ($obj->Cookies->Cookie as $cookie)
		{
			$grabzItCookie = new GrabzItCookie();
			$grabzItCookie->Name = (string)$cookie->Name;
			$grabzItCookie->Value = (string)$cookie->Value;
			$grabzItCookie->Domain = (string)$cookie->Domain;
			$grabzItCookie->Path = (string)$cookie->Path;
			$grabzItCookie->HttpOnly = ((string)$cookie->HttpOnly == GrabzItClient::TrueString);
			$grabzItCookie->Expires = (string)$cookie->Expires;
			$grabzItCookie->Type = (string)$cookie->Type;

			$result[] = $grabzItCookie;
		}

		return $result;
	}
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;
	}
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;
    }
803662
public function clearCookie($domain = '-', $path = null)
    {
        if ($domain === null) {
            $this->_cookies = [];
        } else {
            $domain = strtolower($domain);
            if ($path === null) {
                unset($this->_cookies[$domain]);
            } else {
                if (isset($this->_cookies[$domain])) {
                    unset($this->_cookies[$domain][$path]);
                }
            }
        }
    }
894604
public function removeHttpBasic($domain)
    {
        $this->remove(self::HTTP_BASIC_KEY . '/' . $this->escape($domain));

        return $this;
    }
283253
public function getDomainInfo($domain)
    {
        try {
            $result = $this->getDomainLookupQuery($domain)->getSingleResult();
        } catch (NoResultException $e) {
            $result = null;
        }

        return $result;
    }
77488
protected function getCache($domain)
    {
        if (array_key_exists($domain, $this->cache)) {
            return $this->cache[$domain];
        }

        return null;
    }
88005
private function getRootDomain($domain)
    {
        $domainParts = explode('.', $domain);
        $count       = count($domainParts);

        return $count > 1
            ? $domainParts[$count - 2].'.'.$domainParts[$count - 1]
            : $domainParts[0];
    }
313412
public void setDomainCacheFullUrl(String domain, boolean setting) {
        SetDomainCacheFullUrlRequest request = new SetDomainCacheFullUrlRequest()
                .withDomain(domain);
        request.setCacheFullUrl(setting);
        setDomainCacheFullUrl(request);
    }
808777
protected function addPortToDomain($domain)
    {
        $secure = $this->request->isSecure();

        $port = (int) $this->request->getPort();

        return ($secure && $port === 443) || (! $secure && $port === 80)
                    ? $domain : $domain.':'.$port;
    }
349193
public function allowOrigin($domain)
    {
        $allowed = $this->_normalizeDomains((array)$domain);
        foreach ($allowed as $domain) {
            if (!preg_match($domain['preg'], $this->_origin)) {
                continue;
            }
            $value = $domain['original'] === '*' ? '*' : $this->_origin;
            $this->_headers['Access-Control-Allow-Origin'] = $value;
            break;
        }

        return $this;
    }