Code Duplication    Length = 18-18 lines in 2 locations

src/JsonRepository.php 2 locations

@@ 538-555 (lines=18) @@
535
536
            // We found a mapping that matches the search path
537
            // e.g. mapping /a/b for path /a/b
538
            if ($searchPathForTest === $currentPathForTest) {
539
                $foundMatchingMappings = true;
540
                $currentReferences = $this->resolveReferences($currentPath, $currentReferences, $flags);
541
542
                if (empty($currentReferences)) {
543
                    continue;
544
                }
545
546
                $result[$currentPath] = $currentReferences;
547
548
                // Return unless an explicit mapping order is defined
549
                // In that case, the ancestors need to be searched as well
550
                if (($flags & self::STOP_ON_FIRST) && !isset($this->json['_order'][$currentPath])) {
551
                    return $result;
552
                }
553
554
                continue;
555
            }
556
557
            // We found a mapping that lies within the search path
558
            // e.g. mapping /a/b/c for path /a/b
@@ 583-600 (lines=18) @@
580
            if (0 === strpos($searchPathForTest, $currentPathForTest)) {
581
                $foundMatchingMappings = true;
582
583
                if ($flags & self::INCLUDE_ANCESTORS) {
584
                    // Include the references of the ancestor
585
                    $currentReferences = $this->resolveReferences($currentPath, $currentReferences, $flags);
586
587
                    if (empty($currentReferences)) {
588
                        continue;
589
                    }
590
591
                    $result[$currentPath] = $currentReferences;
592
593
                    // Return unless an explicit mapping order is defined
594
                    // In that case, the ancestors need to be searched as well
595
                    if (($flags & self::STOP_ON_FIRST) && !isset($this->json['_order'][$currentPath])) {
596
                        return $result;
597
                    }
598
599
                    continue;
600
                }
601
602
                if ($flags & self::NO_SEARCH_FILESYSTEM) {
603
                    continue;