forked from LiveCarta/PayPal-PHP-Server-SDK
Automated commit message
This commit is contained in:
45
src/Http/ApiResponse.php
Normal file
45
src/Http/ApiResponse.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PayPalRESTAPIsLib
|
||||
*
|
||||
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
||||
*/
|
||||
|
||||
namespace PayPalRESTAPIsLib\Http;
|
||||
|
||||
use Core\Types\Sdk\CoreApiResponse;
|
||||
|
||||
/**
|
||||
* Holds the result of an API call.
|
||||
*/
|
||||
class ApiResponse extends CoreApiResponse
|
||||
{
|
||||
/**
|
||||
* Create a new instance of this class with the given context and result.
|
||||
*
|
||||
* @param mixed $decodedBody Decoded response body
|
||||
* @param mixed $result Deserialized result from the response
|
||||
* @param HttpContext $context Http context
|
||||
*/
|
||||
public static function createFromContext($decodedBody, $result, HttpContext $context): self
|
||||
{
|
||||
$request = $context->getRequest();
|
||||
$statusCode = $context->getResponse()->getStatusCode();
|
||||
$reasonPhrase = null; // TODO
|
||||
$headers = $context->getResponse()->getHeaders();
|
||||
$body = $context->getResponse()->getRawBody();
|
||||
|
||||
return new self($request, $statusCode, $reasonPhrase, $headers, $result, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the original request that resulted in this response.
|
||||
*/
|
||||
public function getRequest(): HttpRequest
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user