Code Duplication    Length = 18-18 lines in 2 locations

src/JsonRepository.php 2 locations

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