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