public function ResponseHeaderBag::getCookies in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/ResponseHeaderBag.php \Symfony\Component\HttpFoundation\ResponseHeaderBag::getCookies()
Returns an array with all cookies.
Parameters
string $format:
Return value
array
Throws
\InvalidArgumentException When the $format is invalid
1 call to ResponseHeaderBag::getCookies()
- ResponseHeaderBag::__toString in vendor/
symfony/ http-foundation/ ResponseHeaderBag.php - Returns the headers as a string.
File
- vendor/
symfony/ http-foundation/ ResponseHeaderBag.php, line 188
Class
- ResponseHeaderBag
- ResponseHeaderBag is a container for Response HTTP headers.
Namespace
Symfony\Component\HttpFoundationCode
public function getCookies($format = self::COOKIES_FLAT) {
if (!in_array($format, array(
self::COOKIES_FLAT,
self::COOKIES_ARRAY,
))) {
throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(
self::COOKIES_FLAT,
self::COOKIES_ARRAY,
))));
}
if (self::COOKIES_ARRAY === $format) {
return $this->cookies;
}
$flattenedCookies = array();
foreach ($this->cookies as $path) {
foreach ($path as $cookies) {
foreach ($cookies as $cookie) {
$flattenedCookies[] = $cookie;
}
}
}
return $flattenedCookies;
}