Header::header()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace FMUP\Response;
3
4
abstract class Header
5
{
6
    /**
7
     * @var string
8
     */
9
    protected $value;
10
11
    /**
12
     * Define value to use
13
     * @param string $value
14
     * @return $this
15
     */
16 15
    public function setValue($value)
17
    {
18 15
        $this->value = (string)$value;
19 15
        return $this;
20
    }
21
22
    /**
23
     * Retrieve defined value
24
     * @return string
25
     */
26 6
    public function getValue()
27
    {
28 6
        return (string)$this->value;
29
    }
30
31
    /**
32
     * Type for the header. Can be used to determine header to send
33
     * @return string
34
     */
35
    abstract public function getType();
36
37
    /**
38
     * Displays the header
39
     * @return $this
40
     */
41 2
    public function render()
42
    {
43 2
        $this->header($this->getType() . ': ' . $this->getValue());
44 2
        return $this;
45
    }
46
47
    /**
48
     * @param string $value
49
     * @codeCoverageIgnore
50
     */
51
    protected function header($value)
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
52
    {
53
        header($value);
54
    }
55
}
56