Completed
Pull Request — master (#42)
by Povilas
02:03
created

PHPFinder::__construct()   B

Complexity

Conditions 4
Paths 8

Size

Total Lines 27
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 27
rs 8.5806
cc 4
eloc 19
nc 8
nop 5
1
<?php
2
3
namespace Povils\PHPMND;
4
5
use Symfony\Component\Finder\Finder;
6
7
/**
8
 * Class Finder
9
 *
10
 * @package Povils\PHPMND
11
 */
12
class PHPFinder extends Finder
13
{
14
    /**
15
     * @param string $directory
16
     * @param array  $exclude
17
     * @param array  $excludePaths
18
     * @param array  $excludeFiles
19
     * @param array  $suffixes
20
     */
21
    public function __construct(
22
        $directory,
23
        array $exclude,
24
        array $excludePaths,
25
        array $excludeFiles,
26
        array $suffixes
27
    ) {
28
        parent::__construct();
29
        $this
30
            ->files()
31
            ->in($directory)
32
            ->exclude(array_merge(['vendor'], $exclude))
33
            ->ignoreDotFiles(true)
34
            ->ignoreVCS(true);
35
36
        foreach ($suffixes as $suffix) {
37
            $this->name('*.' . $suffix);
38
        }
39
40
        foreach ($excludePaths as $notPath) {
41
            $this->notPath($notPath);
42
        }
43
44
        foreach ($excludeFiles as $notName) {
45
            $this->notName($notName);
46
        }
47
    }
48
}
49