@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | protected function addToDb(string $newPath) |
100 | 100 | { |
101 | 101 | DB::alteration_message('considering ' . $newPath); |
102 | - if (! is_dir($newPath)) { |
|
102 | + if (!is_dir($newPath)) { |
|
103 | 103 | $fileName = basename($newPath); |
104 | 104 | $folderPath = str_replace(ASSETS_PATH . '/', '', dirname($newPath)); |
105 | 105 | $folder = Folder::find_or_make($folderPath); |
106 | - $filter = ['Name' => $fileName, 'ParentID' => $folder->ID]; |
|
106 | + $filter = [ 'Name' => $fileName, 'ParentID' => $folder->ID ]; |
|
107 | 107 | $file = File::get()->filter($filter)->exists(); |
108 | - if (! $file) { |
|
108 | + if (!$file) { |
|
109 | 109 | if ($this->isImage($newPath)) { |
110 | 110 | DB::alteration_message('New IMAGE!: ' . $newPath); |
111 | 111 | $file = Image::create(); |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - protected function getDirContents(string $dir, ?array &$results = []) |
|
126 | + protected function getDirContents(string $dir, ?array &$results = [ ]) |
|
127 | 127 | { |
128 | 128 | $files = scandir($dir); |
129 | 129 | |
130 | 130 | foreach ($files as $key => $value) { |
131 | 131 | $path = realpath($dir . DIRECTORY_SEPARATOR . $value); |
132 | - if (! is_dir($path)) { |
|
133 | - $results[] = $path; |
|
132 | + if (!is_dir($path)) { |
|
133 | + $results[ ] = $path; |
|
134 | 134 | } elseif ('.' !== $value && '..' !== $value) { |
135 | 135 | $this->getDirContents($path, $results); |
136 | - $results[] = $path; |
|
136 | + $results[ ] = $path; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -147,19 +147,19 @@ discard block |
||
147 | 147 | PATHINFO_EXTENSION |
148 | 148 | ); |
149 | 149 | |
150 | - return in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true); |
|
150 | + return in_array($ext, [ 'jpeg', 'jpg', 'gif', 'png' ], true); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | protected function normalizePath($path) |
154 | 154 | { |
155 | - return $path . (is_dir($path) && ! preg_match('#/$#', $path) ? '/' : ''); |
|
155 | + return $path . (is_dir($path) && !preg_match('#/$#', $path) ? '/' : ''); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | protected function rscandir($dir, $sort = SCANDIR_SORT_ASCENDING) |
159 | 159 | { |
160 | - $results = []; |
|
160 | + $results = [ ]; |
|
161 | 161 | |
162 | - if (! is_dir($dir)) { |
|
162 | + if (!is_dir($dir)) { |
|
163 | 163 | return $results; |
164 | 164 | } |
165 | 165 | |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | if (is_dir($dir . $object)) { |
173 | 173 | $results = array_merge($results, $this->rscandir($dir . $object, $sort)); |
174 | 174 | } else { |
175 | - $results[] = $dir . $object; |
|
175 | + $results[ ] = $dir . $object; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $results[] = $dir; |
|
180 | + $results[ ] = $dir; |
|
181 | 181 | |
182 | 182 | return $results; |
183 | 183 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | - if (! file_exists($dest)) { |
|
198 | + if (!file_exists($dest)) { |
|
199 | 199 | DB::alteration_message('MKDIR --' . $dest); |
200 | 200 | mkdir($dest, is_int($destmode) ? $destmode : fileperms($source), true); |
201 | 201 | } |
@@ -208,16 +208,16 @@ discard block |
||
208 | 208 | $file = str_replace(' ', ' ', $file); |
209 | 209 | $file_dest = str_replace(' ', ' ', $file_dest); |
210 | 210 | if (is_dir($file)) { |
211 | - if (! file_exists($file_dest)) { |
|
211 | + if (!file_exists($file_dest)) { |
|
212 | 212 | DB::alteration_message('MKDIR --' . $file_dest); |
213 | 213 | mkdir($file_dest, is_int($destmode) ? $destmode : fileperms($file), true); |
214 | 214 | } |
215 | 215 | } else { |
216 | 216 | DB::alteration_message('COPY --' . $file . '-- to --' . $file_dest . '--'); |
217 | 217 | if (file_exists($file)) { |
218 | - if (! file_exists($file_dest)) { |
|
218 | + if (!file_exists($file_dest)) { |
|
219 | 219 | copy($file, $file_dest); |
220 | - if (! file_exists($file_dest)) { |
|
220 | + if (!file_exists($file_dest)) { |
|
221 | 221 | DB::alteration_message('ERROR could not find after copy: --' . $file_dest); |
222 | 222 | die(); |
223 | 223 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $objects = scandir($dir); |
239 | 239 | foreach ($objects as $object) { |
240 | 240 | if ('.' !== $object && '..' !== $object) { |
241 | - if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && ! is_link($dir . '/' . $object)) { |
|
241 | + if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . '/' . $object)) { |
|
242 | 242 | $this->rrmdir($dir . DIRECTORY_SEPARATOR . $object); |
243 | 243 | } else { |
244 | 244 | unlink($dir . DIRECTORY_SEPARATOR . $object); |