Code Duplication    Length = 7-8 lines in 2 locations

src/JsonRepository.php 2 locations

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