@@ -115,7 +115,7 @@ |
||
115 | 115 | ); |
116 | 116 | } |
117 | 117 | |
118 | - return [$path, $node]; |
|
118 | + return [ $path, $node ]; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'mimetype' => $mimeType |
117 | 117 | ]; |
118 | 118 | } catch (\Exception $exception) { |
119 | - $this->logger->logException($exception, ['app' => 'gallery']); |
|
119 | + $this->logger->logException($exception, [ 'app' => 'gallery' ]); |
|
120 | 120 | throw new InternalServerErrorServiceException('Preview generation has failed'); |
121 | 121 | } |
122 | 122 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } |
224 | 224 | } catch (\Exception $exception) { |
225 | 225 | throw new InternalServerErrorServiceException( |
226 | - 'Something went wrong when trying to read' . $file->getPath() |
|
226 | + 'Something went wrong when trying to read'.$file->getPath() |
|
227 | 227 | ); |
228 | 228 | } |
229 | 229 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** @var string[] */ |
30 | 30 | protected $features; |
31 | 31 | /** @var string[] */ |
32 | - protected $ignoreAlbumStrings = ['.nomedia', '.noimage']; |
|
32 | + protected $ignoreAlbumStrings = [ '.nomedia', '.noimage' ]; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Retrieves all files and sub-folders contained in a folder |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | try { |
69 | 69 | return $node && $this->isAllowed($node) && $this->isAvailable($node); |
70 | 70 | } catch (\Exception $exception) { |
71 | - $message = 'The folder is not available: ' . $exception->getMessage(); |
|
71 | + $message = 'The folder is not available: '.$exception->getMessage(); |
|
72 | 72 | $this->logger->error($message); |
73 | 73 | |
74 | 74 | return false; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function getFolderData($node) { |
129 | 129 | $folderData = $this->getNodeData($node); |
130 | - $folderData['freespace'] = $node->getFreeSpace(); |
|
130 | + $folderData[ 'freespace' ] = $node->getFreeSpace(); |
|
131 | 131 | |
132 | 132 | return $folderData; |
133 | 133 | } |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | try { |
147 | 147 | foreach ($this->ignoreAlbumStrings as $ignoreAlbum) { |
148 | 148 | if ($node->nodeExists($ignoreAlbum)) { |
149 | - return []; |
|
149 | + return [ ]; |
|
150 | 150 | } |
151 | 151 | } |
152 | - return [$node]; |
|
152 | + return [ $node ]; |
|
153 | 153 | } catch (StorageNotAvailableException $e) { |
154 | - return []; |
|
154 | + return [ ]; |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | - return []; |
|
158 | + return [ ]; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | throw new NotFoundServiceException($exception->getMessage()); |
196 | 196 | } |
197 | 197 | |
198 | - return []; |
|
198 | + return [ ]; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | ->getId() |
261 | 261 | ); |
262 | 262 | |
263 | - return ($sid[0] === 'shared' && $sid[2][0] !== '/'); |
|
263 | + return ($sid[ 0 ] === 'shared' && $sid[ 2 ][ 0 ] !== '/'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | private function getOwnerData($node) { |
274 | 274 | $owner = $node->getOwner(); |
275 | - $ownerData = []; |
|
275 | + $ownerData = [ ]; |
|
276 | 276 | if ($owner) { |
277 | 277 | $ownerData = [ |
278 | 278 | 'uid' => $owner->getUID(), |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | class SearchMediaService extends FilesService { |
24 | 24 | |
25 | 25 | /** @var null|array<string,string|int> */ |
26 | - private $images = []; |
|
26 | + private $images = [ ]; |
|
27 | 27 | /** @var null|array<string,string|int> */ |
28 | - private $albums = []; |
|
28 | + private $albums = [ ]; |
|
29 | 29 | /** @var string[] */ |
30 | 30 | private $supportedMediaTypes; |
31 | 31 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->features = $features; |
44 | 44 | $this->searchFolder($folderNode); |
45 | 45 | |
46 | - return [$this->images, $this->albums]; |
|
46 | + return [ $this->images, $this->albums ]; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | private function searchFolder($folder, $subDepth = 0) { |
58 | 58 | $albumImageCounter = 0; |
59 | - $subFolders = []; |
|
59 | + $subFolders = [ ]; |
|
60 | 60 | $this->addFolderToAlbumsArray($folder); |
61 | 61 | $nodes = $this->getNodes($folder, $subDepth); |
62 | 62 | foreach ($nodes as $node) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | private function addFolderToAlbumsArray($folder) { |
198 | 198 | $albumData = $this->getFolderData($folder); |
199 | - $this->albums[$albumData['path']] = $albumData; |
|
199 | + $this->albums[ $albumData[ 'path' ] ] = $albumData; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | private function addFileToImagesArray($mimeType, $file) { |
209 | 209 | $imageData = $this->getNodeData($file); |
210 | - $imageData['mimetype'] = $mimeType; |
|
211 | - $this->images[] = $imageData; |
|
210 | + $imageData[ 'mimetype' ] = $mimeType; |
|
211 | + $this->images[ ] = $imageData; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** @var string */ |
35 | 35 | private $configName = 'gallery.cnf'; |
36 | 36 | /** @var array <string,bool> */ |
37 | - private $completionStatus = ['design' => false, 'information' => false, 'sorting' => false]; |
|
37 | + private $completionStatus = [ 'design' => false, 'information' => false, 'sorting' => false ]; |
|
38 | 38 | /** @var ConfigParser */ |
39 | 39 | private $configParser; |
40 | 40 | /** @var IPreview */ |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return string[] |
98 | 98 | */ |
99 | 99 | public function getFeaturesList() { |
100 | - $featuresList = []; |
|
100 | + $featuresList = [ ]; |
|
101 | 101 | /** @var Folder $rootFolder */ |
102 | 102 | $rootFolder = $this->environment->getVirtualRootFolder(); |
103 | 103 | if ($this->isAllowedAndAvailable($rootFolder) && $this->configExists($rootFolder)) { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @return string[] all supported media types |
124 | 124 | */ |
125 | 125 | public function getSupportedMediaTypes($extraMediaTypes, $nativeSvgSupport) { |
126 | - $supportedMimes = []; |
|
126 | + $supportedMimes = [ ]; |
|
127 | 127 | $wantedMimes = $this->baseMimeTypes; |
128 | 128 | if ($extraMediaTypes) { |
129 | 129 | $wantedMimes = array_merge($wantedMimes, $this->slideshowMimeTypes); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // Let's see if a preview of files of that media type can be generated |
133 | 133 | if ($this->isMimeSupported($wantedMime)) { |
134 | 134 | // We store the media type |
135 | - $supportedMimes[] = $wantedMime; |
|
135 | + $supportedMimes[ ] = $wantedMime; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | $supportedMimes = $this->addSvgSupport($supportedMimes, $nativeSvgSupport); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | private function addSvgSupport($supportedMimes, $nativeSvgSupport) { |
208 | 208 | if (!in_array('image/svg+xml', $supportedMimes) && $nativeSvgSupport) { |
209 | - $supportedMimes[] = 'image/svg+xml'; |
|
209 | + $supportedMimes[ ] = 'image/svg+xml'; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | return $supportedMimes; |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | * @return array <null|array,bool> |
247 | 247 | */ |
248 | 248 | private function collectConfig( |
249 | - $folder, $ignoreAlbumStrings, $configName, $level = 0, $configSoFar = [] |
|
249 | + $folder, $ignoreAlbumStrings, $configName, $level = 0, $configSoFar = [ ] |
|
250 | 250 | ) { |
251 | 251 | foreach ($ignoreAlbumStrings as $ignoreAlbum) { |
252 | 252 | if ($folder->nodeExists($ignoreAlbum)) { |
253 | 253 | // Cancel as soon as we find out that the folder is private or external |
254 | - return [null, true]; |
|
254 | + return [ null, true ]; |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | $isRootFolder = $this->isRootFolder($folder, $level); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $configSoFar = $this->validatesInfoConfig($configSoFar); |
265 | 265 | |
266 | 266 | // We have reached the root folder |
267 | - return [$configSoFar, false]; |
|
267 | + return [ $configSoFar, false ]; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function buildErrorMessage($exception, $folder) { |
305 | 305 | $configPath = $this->environment->getPathFromVirtualRoot($folder); |
306 | - $errorMessage = $exception->getMessage() . ". Config location: /$configPath"; |
|
306 | + $errorMessage = $exception->getMessage().". Config location: /$configPath"; |
|
307 | 307 | $this->logger->error($errorMessage); |
308 | - $config = ['error' => ['message' => $errorMessage]]; |
|
308 | + $config = [ 'error' => [ 'message' => $errorMessage ] ]; |
|
309 | 309 | |
310 | 310 | $completionStatus = $this->completionStatus; |
311 | 311 | foreach ($completionStatus as $key) { |
312 | - $completionStatus[$key] = true; |
|
312 | + $completionStatus[ $key ] = true; |
|
313 | 313 | } |
314 | 314 | $this->completionStatus = $completionStatus; |
315 | 315 | |
316 | - return [$config]; |
|
316 | + return [ $config ]; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -328,12 +328,12 @@ discard block |
||
328 | 328 | private function validatesInfoConfig($albumConfig) { |
329 | 329 | $this->virtualRootLevel; |
330 | 330 | if (array_key_exists('information', $albumConfig)) { |
331 | - $info = $albumConfig['information']; |
|
331 | + $info = $albumConfig[ 'information' ]; |
|
332 | 332 | if (array_key_exists('level', $info)) { |
333 | - $level = $info['level']; |
|
333 | + $level = $info[ 'level' ]; |
|
334 | 334 | if ($level > $this->virtualRootLevel) { |
335 | - $albumConfig['information']['description_link'] = null; |
|
336 | - $albumConfig['information']['copyright_link'] = null; |
|
335 | + $albumConfig[ 'information' ][ 'description_link' ] = null; |
|
336 | + $albumConfig[ 'information' ][ 'copyright_link' ] = null; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function downloadFile($file, $base64Encode = false) { |
37 | 37 | try { |
38 | 38 | $this->logger->debug( |
39 | - "[DownloadService] File to Download: {name}", ['name' => $file->getName()] |
|
39 | + "[DownloadService] File to Download: {name}", [ 'name' => $file->getName() ] |
|
40 | 40 | ); |
41 | 41 | $download = [ |
42 | 42 | 'preview' => $file->getContent(), |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | ]; |
45 | 45 | |
46 | 46 | if ($base64Encode) { |
47 | - $download['preview'] = $this->encode($download['preview']); |
|
47 | + $download[ 'preview' ] = $this->encode($download[ 'preview' ]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $download; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $width = 2 * $height; |
49 | 49 | } |
50 | 50 | |
51 | - $thumbnail = [$width, $height, !$square, $this->animatedPreview, $this->base64Encode]; |
|
51 | + $thumbnail = [ $width, $height, !$square, $this->animatedPreview, $this->base64Encode ]; |
|
52 | 52 | |
53 | 53 | return $thumbnail; |
54 | 54 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * without having to know whether they're private or public |
144 | 144 | */ |
145 | 145 | public function setStandardEnv() { |
146 | - $this->fromRootToFolder = $this->userFolder->getPath() . '/'; |
|
146 | + $this->fromRootToFolder = $this->userFolder->getPath().'/'; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function getNodeFromVirtualRoot($subPath) { |
166 | 166 | $relativePath = $this->getRelativePath($this->fromRootToFolder); |
167 | - $path = $relativePath . '/' . $subPath; |
|
167 | + $path = $relativePath.'/'.$subPath; |
|
168 | 168 | $node = $this->getNodeFromUserFolder($path); |
169 | 169 | |
170 | 170 | return $this->getResourceFromId($node->getId()); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | try { |
191 | 191 | $node = $folder->get($path); |
192 | 192 | } catch (NotFoundException $exception) { |
193 | - $message = 'Could not find anything at: ' . $exception->getMessage(); |
|
193 | + $message = 'Could not find anything at: '.$exception->getMessage(); |
|
194 | 194 | throw new NotFoundEnvException($message); |
195 | 195 | } |
196 | 196 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if ($nodeType === 'dir') { |
245 | 245 | $rootFolder = $node; |
246 | 246 | } else { |
247 | - throw new NotFoundEnvException($node->getPath() . ' is not a folder'); |
|
247 | + throw new NotFoundEnvException($node->getPath().' is not a folder'); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
@@ -357,11 +357,11 @@ discard block |
||
357 | 357 | private function getResourceFromFolderAndId($folder, $resourceId) { |
358 | 358 | $resourcesArray = $folder->getById($resourceId); |
359 | 359 | |
360 | - if (!isset($resourcesArray[0])) { |
|
361 | - throw new NotFoundEnvException('Could not locate node linked to ID: ' . $resourceId); |
|
360 | + if (!isset($resourcesArray[ 0 ])) { |
|
361 | + throw new NotFoundEnvException('Could not locate node linked to ID: '.$resourceId); |
|
362 | 362 | } |
363 | 363 | |
364 | - return $resourcesArray[0]; |
|
364 | + return $resourcesArray[ 0 ]; |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | private function buildFromRootToFolder($fileSource) { |
378 | 378 | $resource = $this->getResourceFromId($fileSource); |
379 | - $fromRootToFolder = $resource->getPath() . '/'; |
|
379 | + $fromRootToFolder = $resource->getPath().'/'; |
|
380 | 380 | |
381 | 381 | return $fromRootToFolder; |
382 | 382 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @return string |
397 | 397 | */ |
398 | 398 | private function getRelativePath($fullPath) { |
399 | - $folderPath = $this->userFolder->getPath() . '/'; |
|
399 | + $folderPath = $this->userFolder->getPath().'/'; |
|
400 | 400 | $origShareRelPath = str_replace($folderPath, '', $fullPath); |
401 | 401 | |
402 | 402 | return $origShareRelPath; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'name' => 'page#public_index', |
36 | 36 | 'url' => '/s/{token}/{filename}', |
37 | 37 | 'verb' => 'GET', |
38 | - 'defaults' => ['filename' => null] |
|
38 | + 'defaults' => [ 'filename' => null ] |
|
39 | 39 | ], |
40 | 40 | // Landing page after password entry, for public galleries |
41 | 41 | [ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'name' => 'files#download', |
83 | 83 | 'url' => '/files/download/{fileId}', |
84 | 84 | 'verb' => 'GET', |
85 | - 'defaults' => ['fileId' => null] |
|
85 | + 'defaults' => [ 'fileId' => null ] |
|
86 | 86 | ], |
87 | 87 | // Batch creation of thumbnails |
88 | 88 | [ |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | 'name' => 'files_public#download', |
114 | 114 | 'url' => '/files.public/download/{fileId}', |
115 | 115 | 'verb' => 'GET', |
116 | - 'defaults' => ['fileId' => null] |
|
116 | + 'defaults' => [ 'fileId' => null ] |
|
117 | 117 | ], |
118 | 118 | [ |
119 | 119 | 'name' => 'preview_public#get_thumbnails', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | 'name' => 'config_api#preflighted_cors', // Valid for all API end points |
133 | 133 | 'url' => '/api/{path}', |
134 | 134 | 'verb' => 'OPTIONS', |
135 | - 'requirements' => ['path' => '.+'] |
|
135 | + 'requirements' => [ 'path' => '.+' ] |
|
136 | 136 | ], |
137 | 137 | [ |
138 | 138 | 'name' => 'config_api#get', |