CookiesCrypter
FinalYes
Class CookiesCrypter Designed to encrypt and decrypt cookies.
Table of Contents
Constants
- COOKIE_MAX_SIZE = 4096
- COOKIE_RESERVED_SUFFIX_BYTES = 3
Methods
- __construct() : mixed
- decrypt() : string
- Decrypts cookie if needed.
- encrypt() : iterable<string|int, mixed>|array<string|int, Cookie>
- Packs and encrypts cookie.
- getCipherKey() : string
- Returns cipher key.
- shouldDecrypt() : bool
- Checks if cookie should be decrypted.
- shouldEncrypt() : bool
- Checks if cookie should be encrypted.
Constants
COOKIE_MAX_SIZE
public
mixed
COOKIE_MAX_SIZE
= 4096
COOKIE_RESERVED_SUFFIX_BYTES
public
mixed
COOKIE_RESERVED_SUFFIX_BYTES
= 3
Methods
__construct()
public
__construct() : mixed
decrypt()
Decrypts cookie if needed.
public
decrypt(string $name, string $value, iterable<string|int, mixed> $cookies) : string
Parameters
- $name : string
-
Cookie name.
- $value : string
-
Encrypted cookie value.
- $cookies : iterable<string|int, mixed>
-
Cookies to decrypt.
Return values
stringencrypt()
Packs and encrypts cookie.
public
encrypt(CryptoCookie $cookie) : iterable<string|int, mixed>|array<string|int, Cookie>
Parameters
- $cookie : CryptoCookie
-
Cookie to encrypt.
Tags
Return values
iterable<string|int, mixed>|array<string|int, Cookie>getCipherKey()
Returns cipher key.
public
getCipherKey() : string
Return values
stringshouldDecrypt()
Checks if cookie should be decrypted.
public
shouldDecrypt(string $cookieName, string $cookieValue) : bool
Parameters
- $cookieName : string
-
Cookie name.
- $cookieValue : string
-
Cookie value.
Return values
boolshouldEncrypt()
Checks if cookie should be encrypted.
public
shouldEncrypt(Cookie $cookie) : bool
Parameters
- $cookie : Cookie
-
Cookie to check.