1 | <?php |
||
5 | class Filesystem |
||
6 | { |
||
7 | private $app; |
||
8 | protected $root; |
||
9 | |||
10 | 11 | public function __construct(Application $app, $root) |
|
15 | |||
16 | 11 | public function exists() |
|
21 | |||
22 | 11 | public function getPath() |
|
37 | |||
38 | 11 | public function listClasses($namespace = '') |
|
62 | |||
63 | 11 | public function listFiles($location) |
|
64 | { |
||
65 | 11 | $absolute = $this->getPath($location); |
|
66 | 11 | if (!is_dir($absolute)) { |
|
67 | return []; |
||
68 | } |
||
69 | |||
70 | 11 | $result = []; |
|
71 | 11 | $relative = substr($absolute, strlen($this->getPath())); |
|
72 | 11 | foreach (scandir($absolute) as $file) { |
|
73 | 11 | if ($file != '.' && $file != '..') { |
|
74 | 11 | if (is_file("$absolute/$file")) { |
|
75 | 11 | $result[] = $file; |
|
76 | } else { |
||
77 | 2 | foreach ($this->listFiles("$relative/$file") as $child) { |
|
78 | 11 | $result[] = "$file/$child"; |
|
79 | } |
||
80 | } |
||
81 | } |
||
82 | } |
||
83 | |||
84 | 11 | return $result; |
|
85 | } |
||
86 | |||
87 | 11 | public function completeClassName($namespace) |
|
95 | |||
96 | } |
||
97 |