Completed
Push — master ( 0b7b7b...a9a580 )
by Nils
01:40
created

ErrorResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 37
loc 37
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getUri() 4 4 1
A setRequest() 4 4 1
A getRequest() 4 4 1
A setErrorMessage() 4 4 1
A getErrorMessage() 4 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
3
namespace whm\Smoke\Http;
4
5
use GuzzleHttp\Psr7\Response;
6
use phm\HttpWebdriverClient\Http\Response\RequestAwareResponse;
7
use phm\HttpWebdriverClient\Http\Response\UriAwareResponse;
8
use Psr\Http\Message\RequestInterface;
9
10 View Code Duplication
class ErrorResponse extends Response implements UriAwareResponse, RequestAwareResponse
11
{
12
    /**
13
     * @var RequestInterface
14
     */
15
    private $request;
16
17
    private $errorMessage = '';
18
19
    public function getUri()
20
    {
21
        return $this->request->getUri();
22
    }
23
24
    public function setRequest(RequestInterface $request)
25
    {
26
        $this->request = $request;
27
    }
28
29
    public function getRequest()
30
    {
31
        return $this->request;
32
    }
33
34
    public function setErrorMessage($errorMessage)
35
    {
36
        $this->errorMessage = $errorMessage;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getErrorMessage()
43
    {
44
        return $this->errorMessage;
45
    }
46
}
47