LocateFilesByGlobPattern::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 2
c 2
b 0
f 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 2
crap 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