lithium\net\http\Response::_parseCookies()
Parse Set-Cookie
headers.
Parameters
-
array
$headers
Array of
Set-Cookie
headers ornull
if no cookies to set.
Source
protected function _parseCookies($headers) {
foreach ((array) $headers as $header) {
$parts = array_map('trim', array_filter(explode('; ', $header)));
$cookie = array_shift($parts);
list($name, $value) = array_map('urldecode', explode('=', $cookie, 2)) + ['',''];
$options = [];
foreach ($parts as $part) {
$part = array_map('urldecode', explode('=', $part, 2)) + ['',''];
$options[strtolower($part[0])] = $part[1] ?: true;
}
if (isset($options['expires'])) {
$options['expires'] = strtotime($options['expires']);
}
$this->cookies($name, compact('value') + $options);
}
}