HttpResponseHeader   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 84
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 84
loc 84
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getProtocol() 4 4 1
A setProtocol() 5 5 1
A getCode() 4 4 1
A setCode() 5 5 1
A getMessage() 4 4 1
A setMessage() 5 5 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
 * Author: Jairo Rodríguez <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace BFunky\HttpParser\Entity;
10
11 View Code Duplication
class HttpResponseHeader implements HttpHeaderInterface
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $protocol;
17
18
    /**
19
     * @var string
20
     */
21
    protected $code;
22
23
    /**
24
     * @var string
25
     */
26
    protected $message;
27
28
    /**
29
     * HttpResponseHeader constructor.
30
     * @param string $protocol
31
     * @param string $code
32 2
     * @param string $message
33
     */
34 2
    public function __construct(string $protocol, string $code, string $message)
35 2
    {
36 2
        $this->protocol = $protocol;
37 2
        $this->code = $code;
38
        $this->message = $message;
39
    }
40
41
    /**
42 2
     * @return string
43
     */
44 2
    public function getProtocol(): string
45
    {
46
        return $this->protocol;
47
    }
48
49
    /**
50
     * @param string $protocol
51 1
     * @return HttpResponseHeader
52
     */
53 1
    public function setProtocol(string $protocol): HttpResponseHeader
54 1
    {
55
        $this->protocol = $protocol;
56
        return $this;
57
    }
58
59
    /**
60 2
     * @return string
61
     */
62 2
    public function getCode(): string
63
    {
64
        return $this->code;
65
    }
66
67
    /**
68
     * @param string $code
69 1
     * @return HttpResponseHeader
70
     */
71 1
    public function setCode(string $code): HttpResponseHeader
72 1
    {
73
        $this->code = $code;
74
        return $this;
75
    }
76
77
    /**
78 2
     * @return string
79
     */
80 2
    public function getMessage(): string
81
    {
82
        return $this->message;
83
    }
84
85
    /**
86
     * @param string $message
87 1
     * @return HttpResponseHeader
88
     */
89 1
    public function setMessage(string $message): HttpResponseHeader
90 1
    {
91
        $this->message = $message;
92
        return $this;
93
    }
94
}