Boot::init()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0116

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 12
ccs 6
cts 7
cp 0.8571
rs 10
cc 2
nc 2
nop 2
crap 2.0116
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpIso\Descriptor;
6
7
use PhpIso\Descriptor;
8
use PhpIso\IsoFile;
9
use PhpIso\Util\Buffer;
10
11
class Boot extends Descriptor
12
{
13
    /**
14
     * Specify an identification of a system which can recognize and act upon the content of the Boot Identifier and Boot System Use fields in the Boot Record
15
     */
16
    public string $bootSysId = '';
17
18
    public int $bootCatalogLocation;
19
20
    /**
21
     * An identification of the boot system specified in the Boot System Use field of the Boot Record.
22
     */
23
    public string $bootId = '';
24
25
    public string $name = 'Boot volume descriptor';
26
27
    protected int $type = Type::BOOT_RECORD_DESC;
28
29 2
    public function init(IsoFile $isoFile, int &$offset): void
30
    {
31 2
        if ($this->bytes === null) {
32
            return;
33
        }
34
35 2
        $this->bootSysId = Buffer::getString($this->bytes, 32, $offset);
36 2
        $this->bootId = Buffer::getString($this->bytes, 32, $offset);
37 2
        $this->bootCatalogLocation = Buffer::readLSB($this->bytes, 4, $offset);
38
39
        // free some space...
40 2
        $this->bytes = null;
41
    }
42
}
43