InvalidResponseException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 28.57 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 8
loc 28
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 8 8 1
A getResponse() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Disque\Command\Response;
3
4
use Disque\Command\CommandInterface;
5
use Disque\DisqueException;
6
7
class InvalidResponseException extends DisqueException
8
{
9
    /**
10
     * Response
11
     *
12
     * @var string
13
     */
14
    private $response;
15
16 View Code Duplication
    public function __construct(CommandInterface $command, $response)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        parent::__construct(sprintf("Invalid command response. Command %1s got: %2s",
19
            get_class($command),
20
            json_encode($response)
21
        ));
22
        $this->response = $response;
23
    }
24
25
    /**
26
     * Get actual response (if any) that triggered this exception
27
     *
28
     * @return string? Response
0 ignored issues
show
Documentation introduced by
The doc-type string? could not be parsed: Unknown type name "string?" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
29
     */
30
    public function getResponse()
31
    {
32
        return $this->response;
33
    }
34
}