VersionedHeader::getHeaderLength()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace CHMLib\Header;
4
5
use CHMLib\Reader\Reader;
6
7
/**
8
 * Represent a generic header that specify also version and length.
9
 */
10
abstract class VersionedHeader extends Header
11
{
12
    /**
13
     * The header version.
14
     *
15
     * @var int
16
     */
17
    protected $headerVersion;
18
19
    /**
20
     * The header size.
21
     *
22
     * @var int
23
     */
24
    protected $headerLength;
25
26
    /**
27
     * Initializes the instance.
28
     *
29
     * @param \CHMLib\Reader\Reader $reader The reader that provides the data.
30
     *
31
     * @throws \Exception Throws an Exception in case of errors.
32
     */
33 4
    public function __construct(Reader $reader)
34
    {
35 4
        parent::__construct($reader);
36 4
        $this->headerVersion = $reader->readUInt32();
37 4
        $this->headerLength = $reader->readUInt32();
38 4
    }
39
40
    /**
41
     * Get the header version.
42
     *
43
     * @return int
44
     */
45
    public function getHeaderVersion()
46
    {
47
        return $this->headerVersion;
48
    }
49
50
    /**
51
     * Get the header size.
52
     *
53
     * @return int
54
     */
55 4
    public function getHeaderLength()
56
    {
57 4
        return $this->headerLength;
58
    }
59
}
60