ApiRequestFailedException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace NotificationChannels\Unisender\Exceptions;
4
5
use GuzzleHttp\Exception\RequestException;
6
use Psr\Http\Message\ResponseInterface;
7
8
class ApiRequestFailedException extends \RuntimeException
9
{
10
    /**
11
     * @var ResponseInterface
12
     */
13
    protected $response;
14
15
    /**
16
     * ApiRequestFailedException constructor.
17
     *
18
     * @param RequestException  $exception
19
     * @param ResponseInterface $response
20
     */
21
    public function __construct(RequestException $exception, ResponseInterface $response)
22
    {
23
        parent::__construct('API Request Failed', $response->getStatusCode(), $exception);
24
25
        $this->response = $response;
26
    }
27
28
    /**
29
     * @return ResponseInterface
30
     */
31
    public function getResponse()
32
    {
33
        return $this->response;
34
    }
35
}
36