HttpRequestHeader   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 85
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 85
loc 85
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 getMethod() 4 4 1
A setMethod() 5 5 1
A getPath() 4 4 1
A setPath() 5 5 1
A getProtocol() 4 4 1
A setProtocol() 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 HttpRequestHeader 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 $method;
17
18
    /**
19
     * @var string
20
     */
21
    protected $path;
22
23
    /**
24
     * @var string
25
     */
26
    protected $protocol;
27
28
    /**
29
     * HttpRequestHeader constructor.
30
     * @param string $method
31
     * @param string $path
32 2
     * @param string $protocol
33
     */
34 2
    public function __construct(string $method, string $path, string $protocol)
35 2
    {
36 2
        $this->method = $method;
37 2
        $this->path = $path;
38
        $this->protocol = $protocol;
39
    }
40
41
42
    /**
43 2
     * @return string
44
     */
45 2
    public function getMethod(): string
46
    {
47
        return $this->method;
48
    }
49
50
    /**
51
     * @param string $method
52 1
     * @return HttpRequestHeader
53
     */
54 1
    public function setMethod(string $method): HttpRequestHeader
55 1
    {
56
        $this->method = $method;
57
        return $this;
58
    }
59
60
    /**
61 2
     * @return string
62
     */
63 2
    public function getPath(): string
64
    {
65
        return $this->path;
66
    }
67
68
    /**
69
     * @param string $path
70 1
     * @return HttpRequestHeader
71
     */
72 1
    public function setPath(string $path): HttpRequestHeader
73 1
    {
74
        $this->path = $path;
75
        return $this;
76
    }
77
78
    /**
79 2
     * @return string
80
     */
81 2
    public function getProtocol(): string
82
    {
83
        return $this->protocol;
84
    }
85
86
    /**
87
     * @param string $protocol
88 1
     * @return HttpRequestHeader
89
     */
90 1
    public function setProtocol(string $protocol): HttpRequestHeader
91 1
    {
92
        $this->protocol = $protocol;
93
        return $this;
94
    }
95
}