-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNativeResponseHandler.php
42 lines (36 loc) · 1.04 KB
/
NativeResponseHandler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Microsoft\Kiota\Abstractions;
use Microsoft\Kiota\Abstraction\Promise\FulfilledPromise;
use Psr\Http\Message\ResponseInterface;
use Microsoft\Kiota\Abstraction\Promise\Promise;
/**
* Default response handler that returns the PSR-7 Response
*/
class NativeResponseHandler implements ResponseHandler
{
/**
* @var ResponseInterface|null
*/
private ?ResponseInterface $nativeResponse = null;
/**
* Returns the PSR-7 Response
*
* @return ResponseInterface|null
*/
public function getResponse(): ?ResponseInterface
{
return $this->nativeResponse;
}
/**
* Returns a promise that resolves to the raw PSR-7 response
*
* @param ResponseInterface $response
* @param array<string, array{string, string}>|null $errorMappings
* @return Promise<null>
*/
public function handleResponseAsync(ResponseInterface $response, ?array $errorMappings = null): Promise
{
$this->nativeResponse = $response;
return new FulfilledPromise(null);
}
}