Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
29 | public function getPhpFiles(string $path): FileCollection |
||
30 | { |
||
31 | $directoryIterator = new RecursiveDirectoryIterator($path); |
||
32 | $files = new FileCollection; |
||
33 | foreach (new RecursiveIteratorIterator($directoryIterator) as $file) { |
||
34 | if ($file->getExtension() !== 'php') { |
||
35 | continue; |
||
36 | } |
||
37 | |||
38 | if ($this->fileShouldBeIgnored($file)) { |
||
39 | continue; |
||
40 | } |
||
41 | |||
42 | |||
43 | $files->push(new File(['displayPath' => $file->getPathName(), 'fullPath' => $file->getRealPath()])); |
||
44 | } |
||
45 | |||
46 | return $files; |
||
47 | } |
||
48 | |||
66 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: