mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
|
<?php
|
||
|
|
||
|
/**
|
||
|
* The Cookie_Backend interface for use with `Cookie::$inst`.
|
||
|
*
|
||
|
* See Cookie_DefaultBackend and Cookie
|
||
|
*/
|
||
|
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
|
||
|
*/
|
||
|
public function __construct(array $cookies = null);
|
||
|
|
||
|
/**
|
||
|
* 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
|
||
|
*/
|
||
|
public function set($name, $value, $expiry = 90, $path = null, $domain = null, $secure = false, $httpOnly = false);
|
||
|
|
||
|
/**
|
||
|
* Get the cookie value by name
|
||
|
*
|
||
|
* @param string $name The name of the cookie to get
|
||
|
*
|
||
|
* @return string|null The cookie value or null if unset
|
||
|
*/
|
||
|
public function get($name);
|
||
|
|
||
|
/**
|
||
|
* Get all the cookies
|
||
|
*
|
||
|
* @return array All the cookies
|
||
|
*/
|
||
|
public function getAll();
|
||
|
|
||
|
/**
|
||
|
* 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
|
||
|
*/
|
||
|
public function forceExpiry($name, $path = null, $domain = null, $secure = false, $httpOnly = false);
|
||
|
|
||
|
}
|