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

PHPFinder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 37
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 27 4
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