HttpField::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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