LocalResponse
in package
Local response loaded from a file.
Table of Contents
Properties
- $file : mixed
Methods
- __construct() : mixed
- deserializeResponse() : mixed
- Deserialize the loaded local response into the requested CommonResponse-derived class.
- getHMACSignature() : string
- isValidHMACSignature() : bool
- toArray() : array<string|int, mixed>
Properties
$file
private
mixed
$file
File object of the local response.
Methods
__construct()
public
__construct(mixed $inputFile) : mixed
Parameters
- $inputFile : mixed
-
A string, path or file-like object to load as a local response.
Tags
deserializeResponse()
Deserialize the loaded local response into the requested CommonResponse-derived class.
public
deserializeResponse(string $responseClass) : mixed
Typically used when dealing with V2 webhook callbacks.
Parameters
- $responseClass : string
-
The class name into which the payload should be deserialized.
Tags
Return values
mixed —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, mixed>