2014-05-04 15:34:58 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Cookie_Backend interface for use with `Cookie::$inst`.
|
|
|
|
*
|
|
|
|
* See Cookie_DefaultBackend and Cookie
|
2015-08-24 06:15:38 +02:00
|
|
|
*
|
|
|
|
* @package framework
|
|
|
|
* @subpackage misc
|
2014-05-04 15:34:58 +02:00
|
|
|
*/
|
|
|
|
interface Cookie_Backend {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When creating the backend we want to store the existing cookies in our
|
|
|
|
* "existing" array. This allows us to distinguish between cookies we recieved
|
|
|
|
* or we set ourselves (and didn't get from the browser)
|
|
|
|
*
|
|
|
|
* @param array $cookies The existing cookies to load into the cookie jar
|
|
|
|
*/
|
2014-09-26 06:01:23 +02:00
|
|
|
public function __construct($cookies = array());
|
2015-09-28 11:21:08 +02:00
|
|
|
|
2014-05-04 15:34:58 +02:00
|
|
|
/**
|
|
|
|
* Set a cookie
|
|
|
|
*
|
|
|
|
* @param string $name The name of the cookie
|
|
|
|
* @param string $value The value for the cookie to hold
|
|
|
|
* @param int $expiry The number of days until expiry
|
|
|
|
* @param string $path The path to save the cookie on (falls back to site base)
|
|
|
|
* @param string $domain The domain to make the cookie available on
|
|
|
|
* @param boolean $secure Can the cookie only be sent over SSL?
|
|
|
|
* @param boolean $httpOnly Prevent the cookie being accessible by JS
|
|
|
|
*/
|
2014-09-26 06:01:23 +02:00
|
|
|
public function set($name, $value, $expiry = 90, $path = null, $domain = null, $secure = false, $httpOnly = true);
|
2015-09-28 11:21:08 +02:00
|
|
|
|
2014-05-04 15:34:58 +02:00
|
|
|
/**
|
|
|
|
* Get the cookie value by name
|
|
|
|
*
|
|
|
|
* @param string $name The name of the cookie to get
|
2014-09-26 06:01:23 +02:00
|
|
|
* @param boolean $includeUnsent Include cookies we've yet to send when fetching values
|
2014-05-04 15:34:58 +02:00
|
|
|
*
|
|
|
|
* @return string|null The cookie value or null if unset
|
|
|
|
*/
|
2014-09-26 06:01:23 +02:00
|
|
|
public function get($name, $includeUnsent = true);
|
2015-09-28 11:21:08 +02:00
|
|
|
|
2014-05-04 15:34:58 +02:00
|
|
|
/**
|
|
|
|
* Get all the cookies
|
|
|
|
*
|
2014-09-26 06:01:23 +02:00
|
|
|
* @param boolean $includeUnsent Include cookies we've yet to send
|
2014-05-04 15:34:58 +02:00
|
|
|
* @return array All the cookies
|
|
|
|
*/
|
2014-09-26 06:01:23 +02:00
|
|
|
public function getAll($includeUnsent = true);
|
2015-09-28 11:21:08 +02:00
|
|
|
|
2014-05-04 15:34:58 +02:00
|
|
|
/**
|
|
|
|
* Force the expiry of a cookie by name
|
|
|
|
*
|
|
|
|
* @param string $name The name of the cookie to expire
|
|
|
|
* @param string $path The path to save the cookie on (falls back to site base)
|
|
|
|
* @param string $domain The domain to make the cookie available on
|
|
|
|
* @param boolean $secure Can the cookie only be sent over SSL?
|
|
|
|
* @param boolean $httpOnly Prevent the cookie being accessible by JS
|
|
|
|
*/
|
2014-09-26 06:01:23 +02:00
|
|
|
public function forceExpiry($name, $path = null, $domain = null, $secure = false, $httpOnly = true);
|
2014-05-04 15:34:58 +02:00
|
|
|
|
|
|
|
}
|