Section   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 38
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
getContents() 0 1 ?
A __construct() 0 4 1
1
<?php
2
3
namespace CHMLib\Section;
4
5
use CHMLib\CHM;
6
7
/**
8
 * Represent a generic section of data in a CHM file.
9
 */
10
abstract class Section
11
{
12
    /**
13
     * The parent CHM file.
14
     *
15
     * @var CHM
16
     */
17
    protected $chm;
18
19
    /**
20
     * The offset of the section data.
21
     *
22
     * @var int
23
     */
24
    protected $sectionOffset;
25
26
    /**
27
     * Initializes the instance.
28
     *
29
     * @param \CHMLib\CHM $chm The parent CHM file.
30
     */
31 4
    public function __construct(CHM $chm)
32
    {
33 4
        $this->chm = $chm;
34 4
    }
35
36
    /**
37
     * Return the (uncompressed) content.
38
     *
39
     * @param int $offset The position where the data starts (relative to the start of this section).
40
     * @param int $length The length of the (compressed) data.
41
     *
42
     * @throws \Exception Throws an Exception in case of errors.
43
     *
44
     * @return string
45
     */
46
    abstract public function getContents($offset, $length);
47
}
48