Worksheet   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 19
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getWorksheetPaths() 0 13 4
1
<?php declare(strict_types = 1);
2
3
namespace Spaghetti\XLSXParser;
4
5
use XMLReader;
6
7
/**
8
 * @internal
9
 */
10
final class Worksheet extends AbstractXMLResource
11
{
12
    private const SHEET = 'sheet';
13
    private const ID = 'id';
14
    private const NAME = 'name';
15
16
    public function getWorksheetPaths(Relationships $relationships): array
17
    {
18
        $xml = $this->getXMLReader();
19
        $paths = [];
20
21
        while ($xml->read()) {
22
            if (XMLReader::ELEMENT === $xml->nodeType && self::SHEET === $xml->name) {
23
                $rId = $xml->getAttributeNs(name: self::ID, namespace: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
24
                $paths[$xml->getAttribute(name: self::NAME)] = $relationships->getWorksheetPath(rId: $rId);
25
            }
26
        }
27
28
        return $paths;
29
    }
30
}
31