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

LocateFilesByGlobPattern   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 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