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