1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License)
*/
namespace Slim\Interfaces\Http;
use InvalidArgumentException;
interface CookiesInterface
{
/**
* Get request cookie
*
* @param string $name Cookie name
* @param mixed $default Cookie default value
*
* @return mixed Cookie value if present, else default
*/
public function get($name, $default = null);
/**
* Set response cookie
*
* @param string $name Cookie name
* @param string|array $value Cookie value, or cookie properties
*/
public function set($name, $value);
/**
* Convert to array of `Set-Cookie` headers
*
* @return string[]
*/
public function toHeaders();
/**
* Parse HTTP request `Cookie:` header and extract into a PHP associative array.
*
* @param string $header The raw HTTP request `Cookie:` header
*
* @return array Associative array of cookie names and values
*
* @throws InvalidArgumentException if the cookie data cannot be parsed
*/
public static function parseHeader($header);
}
|