Test Failed
Push — master ( 49d199...9b394e )
by Jairo
02:22
created

HttpField   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 69
ccs 16
cts 16
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A setName() 0 5 1
A getValue() 0 4 1
A setValue() 0 5 1
A fromKeyAndValue() 0 4 1
1
<?php
2
/**
3
 * Author: jairo.rodriguez <[email protected]>
4
 */
5
6
namespace BFunky\HttpParser\Entity;
7
8
9
class HttpField
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $name;
15
16
    /**
17
     * @var string
18
     */
19
    protected $value;
20
21
    /**
22
     * HttpHeaderField constructor.
23
     * @param string $name
24
     * @param string $value
25
     */
26 6
    public function __construct(string $name, string $value)
27
    {
28 6
        $this->name = $name;
29 6
        $this->value = $value;
30 6
    }
31
32
    /**
33
     * @return string
34
     */
35 6
    public function getName(): string
36
    {
37 6
        return $this->name;
38
    }
39
40
    /**
41
     * @param string $name
42
     * @return HttpField
43
     */
44 1
    public function setName(string $name): HttpField
45
    {
46 1
        $this->name = $name;
47 1
        return $this;
48
    }
49
50
    /**
51
     * @return string
52
     */
53 5
    public function getValue(): string
54
    {
55 5
        return $this->value;
56
    }
57
58
    /**
59
     * @param string $value
60
     * @return HttpField
61
     */
62 1
    public function setValue(string $value): HttpField
63
    {
64 1
        $this->value = $value;
65 1
        return $this;
66
    }
67
68
    /**
69
     * @param string $key
70
     * @param string $value
71
     * @return HttpField
72
     */
73 4
    public static function fromKeyAndValue(string $key, string $value)
74
    {
75 4
        return new self($key, $value);
76
    }
77
}