Returns the cookie with the a cookie

@param string $cookieName Name of the cookie to be checked

@return mixed The cookie instance or an array of cookie instances
@throws \AppserverIo\Http\HttpException Is thrown if the requested header is not available
517842
public function getCookie($cookieName)
    {
        if ($this->hasCookie($cookieName) === false) {
            throw new HttpException("Cookie '$cookieName' not found");
        }
        return $this->cookies[$cookieName];
    }
484651
protected function seeCookie($cookieName, $value = null, $encrypted = true, $unserialize = true)
    {
        $headers = $this->response->headers;

        $exist = false;

        foreach ($headers->getCookies() as $cookie) {
            if ($cookie->getName() === $cookieName) {
                $exist = true;
                break;
            }
        }

        $this->assertTrue($exist, "Cookie [{$cookieName}] not present on response.");

        if (! $exist || is_null($value)) {
            return $this;
        }

        $cookieValue = $cookie->getValue();

        $actual = $encrypted
            ? $this->app['encrypter']->decrypt($cookieValue, $unserialize) : $cookieValue;

        $this->assertEquals(
            $actual, $value,
            "Cookie [{$cookieName}] was found, but value [{$actual}] does not match [{$value}]."
        );

        return $this;
    }
1306792
private function getCookie($url, $httpHeader = [])
    {
        if (!empty($httpHeader['cookie'])) {
            $this->logger->info('Found cookie "{cookie}" for url "{url}" from site config', ['cookie' => $httpHeader['cookie'], 'url' => $url]);

            $cookies = [];
            $pieces = array_filter(array_map('trim', explode(';', $httpHeader['cookie'])));

            foreach ($pieces as $part) {
                $cookieParts = explode('=', $part, 2);
                $key = trim($cookieParts[0]);

                if (1 === \count($cookieParts)) {
                    // Can be a single value (e.g. secure, httpOnly)
                    $value = true;
                } else {
                    // Be sure to strip wrapping quotes
                    $value = trim($cookieParts[1], " \n\r\t\0\x0B\"");
                }

                $cookies[$key] = $value;
            }

            return $cookies;
        }

        return false;
    }
1029298
protected function initCookieFile($username)
    {
        $cookieName = self::COOKIE_PREFIX . $username;
        $cookieFilePath = $this->getCookiesPath() . DIRECTORY_SEPARATOR . $cookieName;

        if (!file_exists($cookieFilePath)) {
            touch($cookieFilePath);
        }

        return $cookieFilePath;
    }
1145579
public function getCookieNamed($name)
    {
        $cookies = $this->getCookies();
        foreach ($cookies as $cookie) {
            if ($cookie['name'] === $name) {
                return $cookie;
            }
        }

        return null;
    }
265145
private function matchesSubstring($cookieName)
    {
        Types::assert(['string' => [$cookieName]]);

        foreach ($this->cookieList as $forbidden)
        {
            if (strpos(strtolower($cookieName), $forbidden) !== false)
            {
                return true;
            }
        }

        return false;
    }
1288451
public function name($name = null)
    {
        if ($name !== null) {
            if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
                throw new \InvalidArgumentException(sprintf('Cookie name "%s" contains invalid characters', $name));
            }

            if (empty($name)) {
                throw new \InvalidArgumentException('Cookie name cannot be empty');
            }

            $this->name = $name;
        }

        return $this->name;
    }
739105
protected function getDomain($domainName)
    {
        $entityManager = $this->getEntityManager();

        /** @var \Rcm\Repository\Domain $domainRepo */
        $domainRepo = $entityManager->getRepository(
            \Rcm\Entity\Domain::class
        );

        $domain = $domainRepo->getDomainByName($domainName);

        if (!$domain instanceof Domain) {
            throw new \Exception("Domain {$domainName} could not be found.");
        }

        return $domain;
    }
1123969
public function getCookieValue(string $name): ?string
    {
        $cookie = $this->cookies->get($name);

        return $cookie !== null ? $cookie->getValue() : null;
    }
974773
public static function GetAuthCookieValue ($name = self::DEFAULT_CONNECTION_NAME) {
		$options = static::GetAuthCookieOptions($name);

		$cookie_name_prefix	= $options['cookie_name_prefix'];
		$cookie_name_safix	= $options['cookie_name_safix'];

		$cookie_pattern	= sprintf("/^%s.+%s$/", $cookie_name_prefix, $cookie_name_safix);
		foreach (Request::GetCookies() as $name => $value) {
			if (preg_match($cookie_pattern, $name, $matches) !== 0) {
				return [$matches[0], $value];
			}
		}
		return null;
	}
104462
private function getProvider($providerName)
    {
        $provider = is_null($providerName)
            ? $this->providers->first()
            : $this->providers->get($providerName);

        return $this->provider = new Provider($provider);
    }
1254826
public function getCookie($name = '')
    {
        if (isset(CookieContainer::getCookies()[$name])) {
            return CookieContainer::getCookies()[$name];
        } else {
            return false;
        }
    }
456596
public function get($cookie)
    {
        if (!$this->has($cookie)) {
            if ($this->getRequest()) {
                return $this->getRequest()->getCookie($cookie);
            }
            
            return null;
        }
        
        return $this->_cookies[$cookie]['value'];
    }
292432
public function readCookie(string $cookieName): ValueReader
    {
        return new ValueReader(
                $this->cookies->errors(),
                $cookieName,
                $this->cookies->value($cookieName)
        );
    }
803499
private function isCandidateCookie($cookieName)
    {
        Types::assert(['string' => [$cookieName]]);

        if ($this->matchSubstring)
        {
            return $this->matchesSubstring($cookieName);
        }
        else
        {
            return $this->matchesFully($cookieName);
        }
    }
554097
public function getCookie($name = null)
    {
        $cookie  = $_COOKIE;
        $encrypt = $this->vitex->getConfig('cookies.encrypt');
        if ($encrypt) {
            $secret_key = $this->vitex->getConfig('cookies.secret_key');
            foreach ($cookie as &$c) {
                try {
                    $c = Utils::decrypt($c, $secret_key);
                } catch(Exception $e){}
            }
        }
        if ($name === null) {
            return $cookie;
        }
        return isset($cookie[$name]) ? $cookie[$name] : '';
    }
459061
public static function get($name)
    {
        if (self::existe($name)) {
            return $_COOKIE[$name];
        }

        exception(CookieKeyNotFoundException::class, $name);
    }