mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-22 16:56:50 +01:00
Move Cookie::makeHeader()
to Header::make()
This commit is contained in:
parent
f28f8ef408
commit
0c91f35119
@ -29,7 +29,7 @@ class Cookie
|
||||
throw new InvalidArgumentException(sprintf('Invalid cookie name "%s"', $name));
|
||||
}
|
||||
$data = [$name => rawurlencode($value)] + static::parseOptions($options);
|
||||
Header::send('Set-Cookie', static::makeHeader($data), $replace);
|
||||
Header::send('Set-Cookie', Header::make($data), $replace);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,16 +80,4 @@ class Cookie
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make Set-Cookie header string
|
||||
*/
|
||||
protected static function makeHeader(array $data): string
|
||||
{
|
||||
$parts = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$parts[] = is_int($key) ? $value : $key . '=' . $value;
|
||||
}
|
||||
return implode('; ', $parts);
|
||||
}
|
||||
}
|
||||
|
@ -149,4 +149,16 @@ class Header
|
||||
static::send('Location', $uri);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make header content
|
||||
*/
|
||||
public static function make(array $data): string
|
||||
{
|
||||
$parts = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$parts[] = is_int($key) ? $value : $key . '=' . $value;
|
||||
}
|
||||
return implode('; ', $parts);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user