Code Duplication    Length = 7-8 lines in 2 locations

src/JsonRepository.php 2 locations

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