VersionedHeader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 77.78%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 50
ccs 7
cts 9
cp 0.7778
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getHeaderVersion() 0 4 1
A getHeaderLength() 0 4 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