Completed
Push — master ( 9e1ab8...e0f7b9 )
by Bill
04:14 queued 02:03
created

FileManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPhpFiles() 0 12 3
1
<?php declare(strict_types = 1);
2
3
namespace Churn\Managers;
4
5
use RecursiveDirectoryIterator;
6
use RecursiveIteratorIterator;
7
8
class FileManager
9
{
10
    /**
11
     * Recursively finds all files with the .php extension in the provided
12
     * $path and returns list as array.
13
     * @param  string $path Path to look for .php files.
14
     * @return array
15
     */
16
    public function getPhpFiles(string $path): array
17
    {
18
        $directoryIterator = new RecursiveDirectoryIterator($path);
19
        $files = [];
20
        foreach (new RecursiveIteratorIterator($directoryIterator) as $file) {
21
            if ($file->getExtension() !== 'php') {
22
                continue;
23
            }
24
            $files[] = $file->getRealPath();
25
        }
26
        return $files;
27
    }
28
}
29