LocalResponse
in package
Local response loaded from a file.
Table of Contents
Properties
- $file : resource
Methods
- __construct() : mixed
- deserializeResponse() : T
- Deserialize the loaded local response into the requested BaseResponse-derived class.
- getHMACSignature() : string
- isValidHMACSignature() : bool
- toArray() : array<string, int|float|string|bool|null|array<string|int, mixed>>
Properties
$file
private
resource
$file
File object of the local response.
Methods
__construct()
public
__construct(resource|string|array<string|int, string> $inputFile) : mixed
Parameters
- $inputFile : resource|string|array<string|int, string>
-
A string, path or file-like object to load as a local response.
Tags
deserializeResponse()
Deserialize the loaded local response into the requested BaseResponse-derived class.
public
deserializeResponse(T> $responseClass) : T
Parameters
- $responseClass : T>
-
The class name into which the payload should be deserialized.
Tags
Return values
T —An instance of responseClass populated with the file content.
getHMACSignature()
public
getHMACSignature(string $secretKey) : string
Parameters
- $secretKey : string
-
Secret key as a string.
Tags
Return values
string —a valid HMAC signature
isValidHMACSignature()
public
isValidHMACSignature(string $secretKey, string $signature) : bool
Parameters
- $secretKey : string
-
Secret, given key as a string.
- $signature : string
-
HMAC signature as a string.
Return values
booltoArray()
public
toArray() : array<string, int|float|string|bool|null|array<string|int, mixed>>
Tags
Return values
array<string, int|float|string|bool|null|array<string|int, mixed>> —The file contents.