| @@ 100-122 (lines=23) @@ | ||
| 97 | * |
|
| 98 | * @return string[] |
|
| 99 | */ |
|
| 100 | public function getSourceFiles($base, $dir = '') { |
|
| 101 | ||
| 102 | $base = MiscService::endSlash($base); |
|
| 103 | $dir = MiscService::endSlash($dir); |
|
| 104 | ||
| 105 | $files = []; |
|
| 106 | foreach (new DirectoryIterator($base . $dir) as $file) { |
|
| 107 | ||
| 108 | if (substr($file->getFilename(), 0, 1) === '.') { |
|
| 109 | continue; |
|
| 110 | } |
|
| 111 | ||
| 112 | if ($file->isDir()) { |
|
| 113 | $files[] = $dir . $file->getFilename() . '/'; |
|
| 114 | $files = array_merge($files, $this->getSourceFiles($base, $dir . $file->getFilename())); |
|
| 115 | continue; |
|
| 116 | } |
|
| 117 | ||
| 118 | $files[] = $dir . $file->getFilename(); |
|
| 119 | } |
|
| 120 | ||
| 121 | return $files; |
|
| 122 | } |
|
| 123 | ||
| 124 | ||
| 125 | /** |
|
| @@ 133-155 (lines=23) @@ | ||
| 130 | * |
|
| 131 | * @return string[] |
|
| 132 | */ |
|
| 133 | public function getAppDataFiles($base, $dir = '') { |
|
| 134 | ||
| 135 | $base = MiscService::endSlash($base); |
|
| 136 | $dir = MiscService::endSlash($dir); |
|
| 137 | ||
| 138 | $files = []; |
|
| 139 | foreach (new DirectoryIterator($base . $dir) as $file) { |
|
| 140 | ||
| 141 | if (substr($file->getFilename(), 0, 1) === '.') { |
|
| 142 | continue; |
|
| 143 | } |
|
| 144 | ||
| 145 | if ($file->isDir()) { |
|
| 146 | $files[] = $dir . $file->getFilename() . '/'; |
|
| 147 | $files = array_merge($files, $this->getSourceFiles($base, $dir . $file->getFilename())); |
|
| 148 | continue; |
|
| 149 | } |
|
| 150 | ||
| 151 | $files[] = $dir . $file->getFilename(); |
|
| 152 | } |
|
| 153 | ||
| 154 | return $files; |
|
| 155 | } |
|
| 156 | ||
| 157 | ||
| 158 | /** |
|