Passed
Push — master ( 204e2b...dee98e )
by Gallice
03:34
created

BadResponseException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 28
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A getResponse() 0 4 1
1
<?php
2
3
namespace Tgallice\Wit\Exception;
4
5
use Psr\Http\Message\ResponseInterface;
6
7
class BadResponseException extends \RuntimeException
8
{
9
    /**
10
     * @var ResponseInterface
11
     */
12
    private $response;
13
14
    /**
15
     * @param string $message
16
     * @param int $statusCode
0 ignored issues
show
Bug introduced by
There is no parameter named $statusCode. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
17
     * @param ResponseInterface|null $response
18
     */
19
    public function __construct($message, ResponseInterface $response = null)
20
    {
21
        $code = $response ? $response->getStatusCode() : 0;
22
23
        parent::__construct($message, $code);
24
        $this->response = $response;
25
    }
26
27
    /**
28
     * @return null|ResponseInterface
29
     */
30
    public function getResponse()
31
    {
32
        return $this->response;
33
    }
34
}
35