Total Complexity | 5 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
18 | class CodeFinder |
||
19 | { |
||
20 | /** @var Finder */ |
||
21 | private $finder; |
||
22 | |||
23 | /** @var string[] */ |
||
24 | private $files; |
||
25 | |||
26 | 48 | public function __construct(Finder $finder = null) |
|
30 | 48 | } |
|
31 | |||
32 | 36 | public function addDirectory(string $directory, bool $recursive = true): void |
|
33 | { |
||
34 | 36 | if (!$recursive) { |
|
35 | 18 | $this->finder->depth(0); |
|
36 | } |
||
37 | 36 | $this->finder->in($directory)->files()->name('*.php'); |
|
38 | 36 | foreach ($this->finder as $file) { |
|
39 | 33 | $this->files[] = $file->getContents(); |
|
40 | } |
||
41 | 36 | } |
|
42 | |||
43 | /** @return string[] */ |
||
44 | 36 | public function files(): array |
|
47 | } |
||
48 | } |
||
49 |