Passed
Push — spaghetti ( 4802b3...dd673c )
by simpletoimplement
02:07
created

Worksheet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getWorksheetPaths() 0 16 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
    public function getWorksheetPaths(Relationships $relationships): array
13
    {
14
        $xml = $this->getXMLReader();
15
        $paths = [];
16
17
        while ($xml->read()) {
18
            if (XMLReader::ELEMENT === $xml->nodeType && 'sheet' === $xml->name) {
19
                $rId = $xml->getAttributeNs(
20
                    name: 'id',
21
                    namespace: 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
22
                );
23
                $paths[$xml->getAttribute(name: 'name')] = $relationships->getWorksheetPath(rId: $rId);
24
            }
25
        }
26
27
        return $paths;
28
    }
29
}
30