Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (CookieScopeInterface $scope, CookieReaderInterface $reader, LoggerInterface $logger=null, HttpHeader $httpHeader=null) | |
setSensitiveCookie ($name, $value, SensitiveCookieMetadata $metadata=null) | |
setPublicCookie ($name, $value, PublicCookieMetadata $metadata=null) | |
getCookie ($name, $default=null) | |
deleteCookie ($name, CookieMetadata $metadata=null) | |
Data Fields | |
const | MAX_NUM_COOKIES = 50 |
const | MAX_COOKIE_SIZE = 4096 |
const | EXPIRE_NOW_TIME = 1 |
const | EXPIRE_AT_END_OF_SESSION_TIME = 0 |
const | KEY_EXPIRE_TIME = 'expiry' |
Protected Member Functions | |
setCookie ($name, $value, array $metadataArray) | |
CookieManager helps manage the setting, retrieving and deleting of cookies.
To aid in security, the cookie manager will make it possible for the application to indicate if the cookie contains sensitive data so that extra protection can be added to the contents of the cookie as well as how the browser stores the cookie.
@SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 25 of file PhpCookieManager.php.
__construct | ( | CookieScopeInterface | $scope, |
CookieReaderInterface | $reader, | ||
LoggerInterface | $logger = null , |
||
HttpHeader | $httpHeader = null |
||
) |
CookieScopeInterface | $scope | |
CookieReaderInterface | $reader | |
LoggerInterface | $logger | |
HttpHeader | $httpHeader |
Definition at line 72 of file PhpCookieManager.php.
deleteCookie | ( | $name, | |
CookieMetadata | $metadata = null |
||
) |
Deletes a cookie with the given name.
string | $name | |
CookieMetadata | $metadata |
FailureToSendException | If cookie couldn't be sent to the browser. If this exception isn't thrown, there is still no guarantee that the browser received and accepted the request to delete this cookie. |
InputException | If the cookie name is empty or contains invalid characters. |
Implements CookieManagerInterface.
Definition at line 291 of file PhpCookieManager.php.
getCookie | ( | $name, | |
$default = null |
|||
) |
Retrieve a value from a cookie.
string | $name | |
string | null | $default | The default value to return if no value could be found for the given $name. |
Implements CookieReaderInterface.
Definition at line 275 of file PhpCookieManager.php.
|
protected |
Set a value in a cookie with the given $name $value pairing.
string | $name | |
string | $value | |
array | $metadataArray |
FailureToSendException | If cookie couldn't be sent to the browser. |
CookieSizeLimitReachedException | Thrown when the cookie is too big to store any additional data. |
InputException | If the cookie name is empty or contains invalid characters. |
Definition at line 135 of file PhpCookieManager.php.
setPublicCookie | ( | $name, | |
$value, | |||
PublicCookieMetadata | $metadata = null |
||
) |
Set a value in a public cookie with the given $name $value pairing.
Public cookies can be accessed by JS. HttpOnly will be set to false by default for these cookies, but can be changed to true.
string | $name | |
string | $value | |
PublicCookieMetadata | $metadata |
FailureToSendException | If cookie couldn't be sent to the browser. |
CookieSizeLimitReachedException | Thrown when the cookie is too big to store any additional data. |
InputException | If the cookie name is empty or contains invalid characters. |
Implements CookieManagerInterface.
Definition at line 118 of file PhpCookieManager.php.
setSensitiveCookie | ( | $name, | |
$value, | |||
SensitiveCookieMetadata | $metadata = null |
||
) |
Set a value in a private cookie with the given $name $value pairing.
Sensitive cookies cannot be accessed by JS. HttpOnly will always be set to true for these cookies.
string | $name | |
string | $value | |
SensitiveCookieMetadata | $metadata |
FailureToSendException | Cookie couldn't be sent to the browser. If this exception isn't thrown, there is still no guarantee that the browser received and accepted the cookie. |
CookieSizeLimitReachedException | Thrown when the cookie is too big to store any additional data. |
InputException | If the cookie name is empty or contains invalid characters. |
Implements CookieManagerInterface.
Definition at line 98 of file PhpCookieManager.php.
const EXPIRE_AT_END_OF_SESSION_TIME = 0 |
Definition at line 35 of file PhpCookieManager.php.
const EXPIRE_NOW_TIME = 1 |
Definition at line 34 of file PhpCookieManager.php.
const KEY_EXPIRE_TIME = 'expiry' |
#- #+ Constant for metadata array key
Definition at line 41 of file PhpCookieManager.php.
const MAX_COOKIE_SIZE = 4096 |
Definition at line 33 of file PhpCookieManager.php.
const MAX_NUM_COOKIES = 50 |
#+ Constants for Cookie manager. RFC 2109 - Page 15 http://www.ietf.org/rfc/rfc6265.txt
Definition at line 32 of file PhpCookieManager.php.