1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | namespace NxSys\Library\Clients\Brex\API\Team\Runtime\Client; |
12: | |
13: | use Psr\Http\Message\ResponseInterface; |
14: | use Symfony\Component\Serializer\SerializerInterface; |
15: | |
16: | trait EndpointTrait |
17: | { |
18: | abstract protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null); |
19: | |
20: | public function parseResponse(ResponseInterface $response, SerializerInterface $serializer, string $fetchMode = Client::FETCH_OBJECT) |
21: | { |
22: | $contentType = $response->hasHeader('Content-Type') ? current($response->getHeader('Content-Type')) : null; |
23: | |
24: | return $this->transformResponseBody($response, $serializer, $contentType); |
25: | } |
26: | } |
27: | |