BunqException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 43
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getClientException() 0 4 1
A getResponseArray() 0 4 1
1
<?php
2
3
namespace Bunq\Exception;
4
5
use GuzzleHttp\Exception\ClientException;
6
7
final class BunqException extends \Exception
8
{
9
    /**
10
     * @var ClientException
11
     */
12
    private $exception;
13
14
    /**
15
     * @var array
16
     */
17
    private $responseArray;
18
19
    /**
20
     * @param ClientException $exception
21
     */
22
    public function __construct(ClientException $exception)
23
    {
24
        $this->exception     = $exception;
25
        $this->responseArray = json_decode((string) $this->exception->getResponse()->getBody(), true);
0 ignored issues
show
Documentation Bug introduced by
It seems like json_decode((string) $th...nse()->getBody(), true) of type * is incompatible with the declared type array of property $responseArray.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
26
27
        parent::__construct(
28
            'Path: ' . $exception->getRequest()->getUri()->getPath() .
29
            ', Message: ' . (string)$exception->getResponse()->getBody(),
30
            $exception->getCode()
31
        );
32
    }
33
34
    /**
35
     * @return ClientException
36
     */
37
    public function getClientException()
38
    {
39
        return $this->exception;
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function getResponseArray()
46
    {
47
        return $this->responseArray;
48
    }
49
}
50