Passed
Pull Request — master (#20)
by
unknown
01:59
created

ApiException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace PoLaKoSz\CoC_API\Exceptions
4
{
5
    use Exception;
6
7
    class ApiException extends Exception
8
    {
9
        public $httpStatusCode;
10
        public $apiResponse;
11
12
        public function __construct($message, $httpStatusCode, $apiResponse) {
13
            $this->httpStatusCode = $httpStatusCode;
14
            $this->apiResponse = $apiResponse;
15
16
            parent::__construct($message, 0, null);
17
        }
18
19
        /**
20
         * @return string
21
         */
22
        public function __toString()
23
        {
24
            return $this->message . '.HTTP: ' . $this->httpStatusCode . '. Response: ' . $this->apiResponse;
25
        }
26
    }
27
}