Code Duplication    Length = 7-8 lines in 2 locations

src/JsonRepository.php 2 locations

@@ 395-402 (lines=8) @@
392
393
        foreach ($references as $currentPath => $currentReferences) {
394
            // Check whether the current entry matches the pattern
395
            if (!isset($result[$currentPath]) && preg_match($regex, $currentPath)) {
396
                // If yes, the first stored reference is returned
397
                $result[$currentPath] = reset($currentReferences);
398
399
                if ($flags & self::STOP_ON_FIRST) {
400
                    return $result;
401
                }
402
            }
403
404
            if ($flags & self::NO_SEARCH_FILESYSTEM) {
405
                continue;
@@ 444-450 (lines=7) @@
441
                foreach ($iterator as $nestedFilesystemPath) {
442
                    $nestedPath = substr_replace($nestedFilesystemPath, $currentPath, 0, $basePathLength);
443
444
                    if (!isset($result[$nestedPath]) && preg_match($regex, $nestedPath)) {
445
                        $result[$nestedPath] = $nestedFilesystemPath;
446
447
                        if ($flags & self::STOP_ON_FIRST) {
448
                            return $result;
449
                        }
450
                    }
451
                }
452
            }
453
        }