Code Duplication    Length = 7-8 lines in 2 locations

src/JsonRepository.php 2 locations

@@ 426-433 (lines=8) @@
423
424
        foreach ($references as $currentPath => $currentReferences) {
425
            // Check whether the current entry matches the pattern
426
            if (!isset($result[$currentPath]) && preg_match($regex, $currentPath)) {
427
                // If yes, the first stored reference is returned
428
                $result[$currentPath] = reset($currentReferences);
429
430
                if ($flags & self::STOP_ON_FIRST) {
431
                    return $result;
432
                }
433
            }
434
435
            if ($flags & self::NO_SEARCH_FILESYSTEM) {
436
                continue;
@@ 475-481 (lines=7) @@
472
                foreach ($iterator as $nestedFilesystemPath) {
473
                    $nestedPath = substr_replace($nestedFilesystemPath, $currentPath, 0, $basePathLength);
474
475
                    if (!isset($result[$nestedPath]) && preg_match($regex, $nestedPath)) {
476
                        $result[$nestedPath] = $nestedFilesystemPath;
477
478
                        if ($flags & self::STOP_ON_FIRST) {
479
                            return $result;
480
                        }
481
                    }
482
                }
483
            }
484
        }