ApiRequestFailedException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getResponse() 0 3 1
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