Completed
Pull Request — master (#38)
by Pádraic
02:50
created

PHPFinder::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 9.4285
cc 3
eloc 13
nc 4
nop 1
1
<?php
2
3
namespace PHPMND;
4
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Finder\Finder;
7
8
/**
9
 * Class Finder
10
 *
11
 * @package PHPMND
12
 */
13
class PHPFinder extends Finder
14
{
15
    /**
16
     * @param InputInterface $input
17
     */
18
    public function __construct(InputInterface $input)
19
    {
20
        parent::__construct();
21
        $this
22
            ->files()
23
            ->in($input->getArgument('directory'))
24
            ->exclude(array_merge(['vendor'], $input->getOption('exclude')))
25
            ->name('*.php')
26
            ->ignoreDotFiles(true)
27
            ->ignoreVCS(true);
28
29
        foreach ($input->getOption('exclude-path') as $notPath) {
30
            $this->notPath($notPath);
31
        }
32
33
        foreach ($input->getOption('exclude-file') as $notName) {
34
            $this->notName($notName);
35
        }
36
    }
37
}
38