Conditions | 7 |
Paths | 48 |
Total Lines | 20 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
7 | public function parse(\DOMElement $node): array |
||
8 | { |
||
9 | $this->manager->setRowColParentNode($node); |
||
10 | $thead = $this->manager->rowColHasHeaders() ? |
||
11 | $this->stringifyList($this->collectRowColDefs($node->firstChild)) : []; |
||
12 | $tbody = $this->manager->rowColHasHeaders() ? |
||
13 | $this->collectRowColRowGroups($node->firstChild) : []; |
||
14 | if (\method_exists($tbody, 'count')) { |
||
15 | $tbody = 1 === $tbody->count() ? |
||
16 | $this->stringifyList($this->collectRows($tbody->item(0)->firstChild)) : $this->stringifyList($tbody); |
||
17 | } |
||
18 | $tbody = 0 === \count($tbody) ? $this->stringifyList($this->collectRows($node->firstChild)) : $tbody; |
||
19 | $thead = 0 === \count($thead) ? \array_shift($tbody) : $thead; |
||
|
|||
20 | |||
21 | return \array_map(function ($row) use ($thead) { |
||
22 | return [ |
||
23 | 'thead' => $thead, |
||
24 | 'tr' => $row, |
||
25 | ]; |
||
26 | }, $tbody); |
||
27 | } |
||
44 |