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