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

ApiException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __toString() 0 4 1
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
}