Section::getContents()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 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