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