Test Failed
Push — master ( 9400f7...aee647 )
by Jairo
02:19
created

HttpField::setValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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
    public function __construct(string $name, string $value)
27
    {
28 4
        $this->name = $name;
29
        $this->value = $value;
30 4
    }
31 4
32 4
    /**
33
     * @return string
34
     */
35
    public function getName(): string
36
    {
37 4
        return $this->name;
38
    }
39 4
40
    /**
41
     * @param string $name
42
     * @return HttpField
43
     */
44
    public function setName(string $name): HttpField
45
    {
46 1
        $this->name = $name;
47
        return $this;
48 1
    }
49 1
50
    /**
51
     * @return string
52
     */
53
    public function getValue(): string
54
    {
55 4
        return $this->value;
56
    }
57 4
58
    /**
59
     * @param string $value
60
     * @return HttpField
61
     */
62
    public function setValue(string $value): HttpField
63
    {
64 1
        $this->value = $value;
65
        return $this;
66 1
    }
67 1
68
    /**
69
     * @param string $key
70
     * @param string $value
71
     * @return HttpField
72
     */
73
    public static function fromKeyAndValue(string $key, string $value){
74
        return new self($key, $value);
75
    }
76
}