Completed
Push — master ( 216072...caf6f7 )
by Team eFabrica
02:21
created

FileFinder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Efabrica\TranslationsAutomatization\FileFinder;
4
5
use Symfony\Component\Finder\Finder;
6
7
class FileFinder implements FileFinderInterface
8
{
9
    private $dirs = [];
10
11
    private $extensions = [];
12
13 6
    public function __construct(array $dirs, array $extensions)
14
    {
15 6
        $this->dirs = $dirs;
16 6
        $this->extensions = $extensions;
17 6
    }
18
19 6
    public function find(): array
20
    {
21 6
        $finder = Finder::create()->files();
22 6
        foreach ($this->extensions as $extension) {
23 6
            $finder->name("*.$extension");
24
        }
25 6
        $finder->in($this->dirs);
26
27 6
        $files = [];
28 6
        foreach ($finder as $file) {
29 6
            $files[] = (string) $file;
30
        }
31 6
        return $files;
32
    }
33
}
34