• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DoclerLabs / api-client-generator / 21433352645

28 Jan 2026 09:50AM UTC coverage: 86.69% (-0.3%) from 86.973%
21433352645

push

github

web-flow
Merge pull request #131 from DoclerLabs/dependabot/composer/phpunit/phpunit-9.6.33

Bump phpunit/phpunit from 9.5.9 to 9.6.33

3465 of 3997 relevant lines covered (86.69%)

7.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Output/Copy/Response/ResponseHandler.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace DoclerLabs\ApiClientGenerator\Output\Copy\Response;
6

7
use DoclerLabs\ApiClientException\Factory\ResponseExceptionFactory;
8
use DoclerLabs\ApiClientException\UnexpectedResponseException;
9
use DoclerLabs\ApiClientGenerator\Output\Copy\Serializer\BodySerializer;
10
use Psr\Http\Message\ResponseInterface;
11

12
class ResponseHandler
13
{
14
    /** @var BodySerializer */
15
    private $bodySerializer;
16

17
    /** @var ResponseExceptionFactory */
18
    private $responseExceptionFactory;
19

20
    public function __construct(BodySerializer $bodySerializer, ResponseExceptionFactory $exceptionFactory)
21
    {
22
        $this->bodySerializer           = $bodySerializer;
×
23
        $this->responseExceptionFactory = $exceptionFactory;
×
24
    }
25

26
    /**
27
     * @throws UnexpectedResponseException
28
     */
29
    public function handle(ResponseInterface $response): array
30
    {
31
        $statusCode = $response->getStatusCode();
×
32
        if ($statusCode >= 200 && $statusCode < 300) {
×
33
            return $this->bodySerializer->unserializeResponse($response);
×
34
        }
35
        throw $this->responseExceptionFactory->create(
×
36
            sprintf('Server replied with a non-200 status code: %s', $response->getStatusCode()),
×
37
            $response
×
38
        );
×
39
    }
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc