Spine   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A __construct() 0 5 2
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