Failed Conditions
Push — master ( 695e78...1160b5 )
by Matthias
03:17 queued 44s
created

LocateFilesByGlobPattern::__invoke()   A

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 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace ComposerRequireChecker\FileLocator;
4
5
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 iterable|string[] the files found by the given glob patterns
15
     * @see https://github.com/webmozart/glob
16
     */
17 3
    public function __invoke(array $globPatterns = [], string $rootDir): iterable
18
    {
19 3
        foreach ($globPatterns as $globPattern) {
20 2
            yield from Glob::glob(rtrim($rootDir, '/') . '/' . $globPattern);
0 ignored issues
show
Bug Best Practice introduced by
The expression YieldFromNode returns the type Generator which is incompatible with the documented return type iterable|string[].
Loading history...
21
        }
22 3
    }
23
24
}
25