(int $parentId, ?int $itemId = null)
| 703 | } |
| 704 | |
| 705 | private function isValidParent(int $parentId, ?int $itemId = null): bool { |
| 706 | if ($parentId === 0) { |
| 707 | return true; |
| 708 | } |
| 709 | if ($itemId !== null && $parentId === $itemId) { |
| 710 | return false; |
| 711 | } |
| 712 | |
| 713 | $visited = []; |
| 714 | $currentId = $parentId; |
| 715 | while ($currentId !== 0) { |
| 716 | if (isset($visited[$currentId]) || ($itemId !== null && $currentId === $itemId)) { |
| 717 | return false; |
| 718 | } |
| 719 | $visited[$currentId] = true; |
| 720 | $parent = $this->ReportMapper->readOwn($currentId); |
| 721 | if (empty($parent) || (int)$parent['type'] !== self::REPORT_TYPE_GROUP) { |
| 722 | return false; |
| 723 | } |
| 724 | $currentId = (int)$parent['parent']; |
| 725 | } |
| 726 | return true; |
| 727 | } |
| 728 | |
| 729 | /** |
| 730 | * rename report |
no test coverage detected