LocateFilesByGlobPattern   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 2
eloc 3
c 2
b 0
f 2
dl 0
loc 13
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 2
1
<?php
2
3
namespace ComposerRequireChecker\FileLocator;
4
5
use Traversable;
6
use Webmozart\Glob\Glob;
7
8
class LocateFilesByGlobPattern
9
{
10
11
    /**
12
     * @param string[] $globPatterns a list of glob patterns to find files in
13
     * @param string $rootDir the root directory that should be used when patterns are relative paths
14
     * @return Traversable<string> the files found by the given glob patterns
15
     * @see https://github.com/webmozart/glob
16
     */
17 10
    public function __invoke(array $globPatterns, string $rootDir): Traversable
18
    {
19 10
        foreach ($globPatterns as $globPattern) {
20 4
            yield from Glob::glob(rtrim($rootDir, '/') . '/' . $globPattern);
21
        }
22 10
    }
23
24
}
25