Conditions | 4 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 4 | public function getInnerToc(): TableOfContents |
|
25 | { |
||
26 | 4 | $children = $this->children(); |
|
27 | 4 | if (! \is_array($children)) { |
|
|
|||
28 | $children = \iterator_to_array($children); |
||
29 | } |
||
30 | |||
31 | 4 | if (\count($children) !== 2) { |
|
32 | throw new InvalidArgumentException( |
||
33 | 'TableOfContentsWrapper nodes should have 2 children, found ' . \count($children) |
||
34 | ); |
||
35 | } |
||
36 | |||
37 | 4 | $inner = $children[1]; |
|
38 | 4 | if (! $inner instanceof TableOfContents) { |
|
39 | throw new InvalidArgumentException( |
||
40 | 'TableOfContentsWrapper second node should be a TableOfContents, found ' . \get_class($inner) |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | 4 | return $inner; |
|
45 | } |
||
47 |