ClientException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getResponseBody() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PCextreme\Cloudstack\Exception;
6
7
use Exception;
8
9
class ClientException extends Exception
10
{
11
    /**
12
     * @var mixed
13
     */
14
    protected $response;
15
16
    /**
17
     * @param  string       $message
18
     * @param  integer      $code
19
     * @param  array|string $response
20
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
21
     */
22
    public function __construct(string $message, int $code, $response)
23
    {
24
        $this->response = $response;
25
26
        parent::__construct($message, $code);
27
    }
28
29
    /**
30
     * Returns the exception's response body.
31
     * @TODO: Refactor this method, so that it returns a single type.
32
     *
33
     * @return array|string
34
     */
35
    public function getResponseBody()
36
    {
37
        return $this->response;
38
    }
39
}
40