Code Duplication    Length = 12-12 lines in 2 locations

src/JsonRepository.php 2 locations

@@ 491-502 (lines=12) @@
488
489
            // We found a mapping that matches the search path
490
            // e.g. mapping /a/b for path /a/b
491
            if ($searchPathForTest === $currentPathForTest) {
492
                $foundMatchingMappings = true;
493
                $result[$currentPath] = $this->resolveReferences($currentReferences, $stopOnFirst);
494
495
                // Return unless an explicit mapping order is defined
496
                // In that case, the ancestors need to be searched as well
497
                if ($stopOnFirst && !isset($this->json['_order'][$currentPath])) {
498
                    return $result;
499
                }
500
501
                continue;
502
            }
503
504
            // We found a mapping that lies within the search path
505
            // e.g. mapping /a/b/c for path /a/b
@@ 506-517 (lines=12) @@
503
504
            // We found a mapping that lies within the search path
505
            // e.g. mapping /a/b/c for path /a/b
506
            if ($includeNested && 0 === strpos($currentPathForTest, $searchPathForTest)) {
507
                $foundMatchingMappings = true;
508
                $result[$currentPath] = $this->resolveReferences($currentReferences, $stopOnFirst);
509
510
                // Return unless an explicit mapping order is defined
511
                // In that case, the ancestors need to be searched as well
512
                if ($stopOnFirst && !isset($this->json['_order'][$currentPath])) {
513
                    return $result;
514
                }
515
516
                continue;
517
            }
518
519
            // We found a mapping that is an ancestor of the search path
520
            // e.g. mapping /a for path /a/b