Header::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace CHMLib\Header;
4
5
use CHMLib\Reader\Reader;
6
7
/**
8
 * A generic header.
9
 */
10
abstract class Header
11
{
12
    /**
13
     * The header signature.
14
     *
15
     * @var string
16
     */
17
    protected $headerSignature;
18
19
    /**
20
     * Initialize the instance.
21
     *
22
     * @param Reader $reader The reader that provides the data.
23
     *
24
     * @throws \Exception Throws an Exception in case of errors.
25
     */
26 4
    public function __construct(Reader $reader)
27
    {
28 4
        $this->headerSignature = $reader->readString(4);
29 4
    }
30
31
    /**
32
     * Get the header signature.
33
     *
34
     * @return string
35
     */
36
    public function getHeaderSignature()
37
    {
38
        return $this->headerSignature;
39
    }
40
}
41