Completed
Push — master ( 6188f9...65fb0e )
by Christian
02:17
created

FullChangeSet::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 1
crap 2
1
<?php
2
3
namespace uuf6429\ElderBrother\Change;
4
5
use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
6
7
class FullChangeSet
8
{
9
    /**
10
     * @param string|null Starting directory (current working dir is used if null)
11
     *
12
     * @return FileList
13
     */
14 13
    public static function get($dir = null)
15
    {
16 13
        $dir = is_null($dir) ? getcwd() : $dir;
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $dir. This often makes code more readable.
Loading history...
17
18 13
        return new FileList(
19 13
            __METHOD__ . '()',
20 13
            function () use ($dir) {
21 13
                return new \RecursiveIteratorIterator(
22 13
                    new RecursiveDirectoryIterator(
23
                        $dir,
24 13
                        RecursiveDirectoryIterator::SKIP_DOTS
25
                    ),
26 13
                    \RecursiveIteratorIterator::CHILD_FIRST
27
                );
28 13
            }
29
        );
30
    }
31
}
32