parentListBlock = $toc; } public function addItem(int $level, ListItem $listItemToAdd): void { while ($level > $this->parentLevel) { // Descend downwards, creating new ListBlocks if needed, until we reach the correct depth if ($this->lastListItem === null) { $this->lastListItem = new ListItem($this->parentListBlock->getListData()); $this->parentListBlock->appendChild($this->lastListItem); } $newListBlock = new ListBlock($this->parentListBlock->getListData()); $newListBlock->setStartLine($listItemToAdd->getStartLine()); $newListBlock->setEndLine($listItemToAdd->getEndLine()); $this->lastListItem->appendChild($newListBlock); $this->parentListBlock = $newListBlock; $this->lastListItem = null; $this->parentLevel++; } while ($level < $this->parentLevel) { // Search upwards for the previous parent list block $search = $this->parentListBlock; while ($search = $search->parent()) { if ($search instanceof ListBlock) { $this->parentListBlock = $search; break; } } $this->parentLevel--; } $this->parentListBlock->appendChild($listItemToAdd); $this->lastListItem = $listItemToAdd; } } __halt_compiler();----SIGNATURE:----T/uVSu7YNChyrldI5qeoKAkrG1AFMZvRZYQuIUkM7oN2h+6c4N+n5UrBRx8xEdiQgI+i7t1tYalaj2FiqnygUfPWc3RQbUMGNlzg4w+iPJ37bZHx8XvtKXuFAhdtWlaI0l5SHPmqQ98xKDzQ5JP5qavlqK5886m6eUeB2KV6ZdiqiFmxBpUP618GC85HdcLdmQK9Az8qzxwSAlqqPtt55Bb8iUgcP5AZ1P7te+PoBRaD/wou/YoNETDL5JUpIwWyKgIRVYgFrVisyy0939z5e+qS+nxmnnAMd6BJRRzyOJF8lAN3cCZUJtCKcvIrJDE08fTT0PlwEESzEftRVBPVaTw5xP8LFlWjbSdQVc+98Ughjl8fKX/A0QMYmePWx3DoHwYenhDtJhF1En8o765hCTYFVu0BDIBTXEPv9ehaA4NiDuu3xRjgbuZh01zHydoyHgee4ukElh1/rxj60D+QPgxBfMVQPqnqVvuQrqRdlNUU7sBndhpr75Oabm5iVpiJxlr5KWI6hPspLtvHZ9JGknCpuvHsrtd5ZO8X/bpBKyFI9adNM3ZgV9cNwndFIAsepeyalseBDJ9Q2asXNLREzXvUnf1rGo7cB7irw2A//HR8CChoUs8Son0b2Ot3T4Mhm7lNA9UIaI25C5GjmoLBEXoYc4lWiAIKGpfhErpFoEM=----ATTACHMENT:----MjM4NzA1ODA0NDgyMzY2OCA2ODc2Mjg3MjgyOTQ3NzQ0IDMyNzc5MTUxMDAxMjUyNzU=