Code Duplication    Length = 18-18 lines in 2 locations

src/JsonRepository.php 2 locations

@@ 549-566 (lines=18) @@
546
547
            // We found a mapping that matches the search path
548
            // e.g. mapping /a/b for path /a/b
549
            if ($searchPathForTest === $currentPathForTest) {
550
                $foundMatchingMappings = true;
551
                $currentReferences = $this->resolveReferences($currentPath, $currentReferences, $flags);
552
553
                if (empty($currentReferences)) {
554
                    continue;
555
                }
556
557
                $result[$currentPath] = $currentReferences;
558
559
                // Return unless an explicit mapping order is defined
560
                // In that case, the ancestors need to be searched as well
561
                if (($flags & self::STOP_ON_FIRST) && !isset($this->json['_order'][$currentPath])) {
562
                    return $result;
563
                }
564
565
                continue;
566
            }
567
568
            // We found a mapping that lies within the search path
569
            // e.g. mapping /a/b/c for path /a/b
@@ 594-611 (lines=18) @@
591
            if (0 === strpos($searchPathForTest, $currentPathForTest)) {
592
                $foundMatchingMappings = true;
593
594
                if ($flags & self::INCLUDE_ANCESTORS) {
595
                    // Include the references of the ancestor
596
                    $currentReferences = $this->resolveReferences($currentPath, $currentReferences, $flags);
597
598
                    if (empty($currentReferences)) {
599
                        continue;
600
                    }
601
602
                    $result[$currentPath] = $currentReferences;
603
604
                    // Return unless an explicit mapping order is defined
605
                    // In that case, the ancestors need to be searched as well
606
                    if (($flags & self::STOP_ON_FIRST) && !isset($this->json['_order'][$currentPath])) {
607
                        return $result;
608
                    }
609
610
                    continue;
611
                }
612
613
                if ($flags & self::NO_SEARCH_FILESYSTEM) {
614
                    continue;