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