\Cake\TestSuite\Constraint\ResponseCookieEncryptedEquals

CookieEncryptedEquals

Summary

Methods
Properties
Constants
__construct()
matches()
toString()
No public properties found
No constants found
_getCookieEncryptionKey()
_encrypt()
_checkCipher()
_decrypt()
_decode()
_implode()
_explode()
_getBodyAsString()
$_validCiphers
$cookieName
$response
$key
$mode
N/A
No private methods found
No private properties found
N/A

Properties

$_validCiphers

$_validCiphers : array

Valid cipher names for encrypted cookies.

Type

array

$cookieName

$cookieName : string

Type

string

$key

$key : string

Type

string

$mode

$mode : string

Type

string

Methods

__construct()

__construct(\Cake\Http\Response  $response, string  $cookieName, string  $mode, string  $key) 

Constructor.

Parameters

\Cake\Http\Response $response

Response

string $cookieName

Cookie name

string $mode

Mode

string $key

Key

matches()

matches(mixed  $other) : boolean

Checks assertion

Parameters

mixed $other

Expected content

Returns

boolean

toString()

toString() : string

Assertion message

Returns

string

_getCookieEncryptionKey()

_getCookieEncryptionKey() : string

Returns the encryption key

Returns

string

_encrypt()

_encrypt(string  $value, string|boolean  $encrypt, string|null  $key = null) : string

Encrypts $value using public $type method in Security class

Parameters

string $value

Value to encrypt

string|boolean $encrypt

Encryption mode to use. False disabled encryption.

string|null $key

Used as the security salt if specified.

Returns

string —

Encoded values

_checkCipher()

_checkCipher(string  $encrypt) : void

Helper method for validating encryption cipher names.

Parameters

string $encrypt

The cipher name.

Throws

\RuntimeException

When an invalid cipher is provided.

_decrypt()

_decrypt(array  $values, string|boolean  $mode, string|null  $key = null) : string|array

Decrypts $value using public $type method in Security class

Parameters

array $values

Values to decrypt

string|boolean $mode

Encryption mode

string|null $key

Used as the security salt if specified.

Returns

string|array —

Decrypted values

_decode()

_decode(string  $value, string|false  $encrypt, string|null  $key) : string|array

Decodes and decrypts a single value.

Parameters

string $value

The value to decode & decrypt.

string|false $encrypt

The encryption cipher to use.

string|null $key

Used as the security salt if specified.

Returns

string|array —

Decoded values.

_implode()

_implode(array  $array) : string

Implode method to keep keys are multidimensional arrays

Parameters

array $array

Map of key and values

Returns

string —

A json encoded string.

_explode()

_explode(string  $string) : string|array

Explode method to return array from string set in CookieComponent::_implode() Maintains reading backwards compatibility with 1.x CookieComponent::_implode().

Parameters

string $string

A string containing JSON encoded data, or a bare string.

Returns

string|array —

Map of key and values

_getBodyAsString()

_getBodyAsString() : string

Get the response body as string

Returns

string —

The response body.