ClientException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
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