Spine::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpEpub;
6
7
use SimpleXMLElement;
8
9
class Spine
10
{
11
    /**
12
     * @var array<int, string>
13
     */
14
    protected array $spine = [];
15
16
    /**
17
     * Spine constructor.
18
     */
19 21
    public function __construct(private readonly SimpleXMLElement $opfXml)
20
    {
21 21
        foreach ($this->opfXml->spine->itemref as $item) {
22 21
            $attr = $item->attributes();
23 21
            $this->spine[] = (string) $attr->idref;
24
        }
25
    }
26
27
    /**
28
     * @return array<int, string>
29
     */
30 7
    public function get(): array
31
    {
32 7
        return $this->spine;
33
    }
34
}
35