@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | * @return null|array |
44 | 44 | */ |
45 | 45 | public function getFeaturesList($folder, $configName) { |
46 | - $featuresList = []; |
|
46 | + $featuresList = [ ]; |
|
47 | 47 | $parsedConfig = $this->parseConfig($folder, $configName); |
48 | 48 | $key = 'features'; |
49 | 49 | if (array_key_exists($key, $parsedConfig)) { |
50 | - $featuresList = $this->parseFeatures($parsedConfig[$key]); |
|
50 | + $featuresList = $this->parseFeatures($parsedConfig[ $key ]); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return $featuresList; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | list($config, $completionStatus) = |
73 | 73 | $this->buildAlbumConfig($currentConfig, $parsedConfig, $completionStatus, $level); |
74 | 74 | |
75 | - return [$config, $completionStatus]; |
|
75 | + return [ $config, $completionStatus ]; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | private function buildAlbumConfig($currentConfig, $parsedConfig, $completionStatus, $level) { |
153 | 153 | foreach ($completionStatus as $key => $complete) { |
154 | 154 | if (!$this->isConfigItemComplete($key, $parsedConfig, $complete)) { |
155 | - $parsedConfigItem = $parsedConfig[$key]; |
|
155 | + $parsedConfigItem = $parsedConfig[ $key ]; |
|
156 | 156 | if ($this->isConfigUsable($key, $parsedConfigItem, $level)) { |
157 | 157 | list($configItem, $itemComplete) = |
158 | 158 | $this->addConfigItem($key, $parsedConfigItem, $level); |
159 | 159 | $currentConfig = array_merge($currentConfig, $configItem); |
160 | - $completionStatus[$key] = $itemComplete; |
|
160 | + $completionStatus[ $key ] = $itemComplete; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - return [$currentConfig, $completionStatus]; |
|
165 | + return [ $currentConfig, $completionStatus ]; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | private function isConfigItemComplete($key, $parsedConfig, $complete) { |
178 | 178 | return !(!$complete |
179 | 179 | && array_key_exists($key, $parsedConfig) |
180 | - && !empty($parsedConfig[$key])); |
|
180 | + && !empty($parsedConfig[ $key ])); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | private function addConfigItem($key, $parsedConfigItem, $level) { |
218 | 218 | if ($key === 'sorting' && !array_key_exists('type', $parsedConfigItem)) { |
219 | 219 | |
220 | - return [[], false]; |
|
220 | + return [ [ ], false ]; |
|
221 | 221 | } else { |
222 | - $parsedConfigItem['level'] = $level; |
|
223 | - $configItem = [$key => $parsedConfigItem]; |
|
222 | + $parsedConfigItem[ 'level' ] = $level; |
|
223 | + $configItem = [ $key => $parsedConfigItem ]; |
|
224 | 224 | $itemComplete = true; |
225 | 225 | |
226 | - return [$configItem, $itemComplete]; |
|
226 | + return [ $configItem, $itemComplete ]; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | private function isConfigInheritable($parsedConfigItem) { |
238 | 238 | $inherit = false; |
239 | 239 | if (array_key_exists('inherit', $parsedConfigItem)) { |
240 | - $inherit = $parsedConfigItem['inherit']; |
|
240 | + $inherit = $parsedConfigItem[ 'inherit' ]; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | if ($inherit === 'yes') { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $message = $exception->getMessage(); |
73 | 73 | $code = $exception->getCode(); |
74 | 74 | |
75 | - $this->logger->debug("[TokenCheckException] {exception}", ['exception' => $message]); |
|
75 | + $this->logger->debug("[TokenCheckException] {exception}", [ 'exception' => $message ]); |
|
76 | 76 | |
77 | 77 | return $this->computeResponse($message, $code); |
78 | 78 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | $this->logger->debug( |
135 | 135 | '[CheckException] Unauthorised Request params: {params}', |
136 | - ['params' => $params] |
|
136 | + [ 'params' => $params ] |
|
137 | 137 | ); |
138 | 138 | |
139 | 139 | return new TemplateResponse($this->appName, 'authenticate', $params, 'guest'); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function redirectToErrorPage($message, $code) { |
151 | 151 | $url = $this->urlGenerator->linkToRoute( |
152 | - $this->appName . '.page.error_page', ['code' => $code] |
|
152 | + $this->appName.'.page.error_page', [ 'code' => $code ] |
|
153 | 153 | ); |
154 | 154 | |
155 | 155 | $response = new RedirectResponse($url); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | |
51 | 51 | // If the exception is not of type ForbiddenServiceException only show a |
52 | 52 | // generic error message to avoid leaking information. |
53 | - if(!($exception instanceof ForbiddenServiceException)) { |
|
54 | - $logger->logException($exception, ['app' => 'gallery']); |
|
53 | + if (!($exception instanceof ForbiddenServiceException)) { |
|
54 | + $logger->logException($exception, [ 'app' => 'gallery' ]); |
|
55 | 55 | $message = sprintf('An error occurred. Request ID: %s', $request->getId()); |
56 | 56 | } else { |
57 | - $message = $exception->getMessage() . ' (' . $code . ')'; |
|
57 | + $message = $exception->getMessage().' ('.$code.')'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return new JSONResponse( |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $message = $exception->getMessage(); |
78 | 78 | $code = $this->getHttpStatusCode($exception); |
79 | 79 | $url = $urlGenerator->linkToRoute( |
80 | - $appName . '.page.error_page', ['code' => $code] |
|
80 | + $appName.'.page.error_page', [ 'code' => $code ] |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | $response = new RedirectResponse($url); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $preview = $this->prepareEmptyThumbnail($file, $status); |
90 | 90 | } |
91 | 91 | |
92 | - return [$preview, $status]; |
|
92 | + return [ $preview, $status ]; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $status = $this->getHttpStatusCode($exception); |
146 | 146 | } |
147 | 147 | |
148 | - return [$file, $status]; |
|
148 | + return [ $file, $status ]; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | list($preview, $status) = $this->getErrorData(); |
174 | 174 | } |
175 | 175 | |
176 | - return [$preview, $status]; |
|
176 | + return [ $preview, $status ]; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @return array<null|int> |
185 | 185 | */ |
186 | 186 | private function getErrorData($status = Http::STATUS_INTERNAL_SERVER_ERROR) { |
187 | - return [null, $status]; |
|
187 | + return [ null, $status ]; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | * @return array<string,null|string> |
212 | 212 | */ |
213 | 213 | private function prepareEmptyThumbnail($file, $status) { |
214 | - $thumbnail = []; |
|
214 | + $thumbnail = [ ]; |
|
215 | 215 | if ($status !== Http::STATUS_NOT_FOUND) { |
216 | 216 | $mimeType = ''; |
217 | 217 | if ($file) { |
218 | 218 | $mimeType = $file->getMimeType(); |
219 | 219 | } |
220 | - $thumbnail = ['preview' => null, 'mimetype' => $mimeType]; |
|
220 | + $thumbnail = [ 'preview' => null, 'mimetype' => $mimeType ]; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $thumbnail; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | foreach ($idsArray as $id) { |
103 | 103 | // Casting to integer here instead of using array_map to extract IDs from the URL |
104 | 104 | list($thumbnail, $status) = $this->getThumbnail((int)$id, $square, $scale); |
105 | - $thumbnail['fileid'] = $id; |
|
106 | - $thumbnail['status'] = $status; |
|
105 | + $thumbnail[ 'fileid' ] = $id; |
|
106 | + $thumbnail[ 'status' ] = $status; |
|
107 | 107 | |
108 | 108 | $this->eventSource->send('preview', $thumbnail); |
109 | 109 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | /** @type File $file */ |
130 | 130 | list($file, $status) = $this->getFile($fileId); |
131 | 131 | if ($this->request->getHeader('If-None-Match') === $file->getEtag()) { |
132 | - return new DataResponse([], Http::STATUS_NOT_MODIFIED); |
|
132 | + return new DataResponse([ ], Http::STATUS_NOT_MODIFIED); |
|
133 | 133 | } |
134 | 134 | list($file, $preview, $status) = $this->getData($fileId, $width, $height); |
135 | 135 | |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | ], $status |
142 | 142 | ); |
143 | 143 | } |
144 | - $preview['name'] = $file->getName(); |
|
144 | + $preview[ 'name' ] = $file->getName(); |
|
145 | 145 | |
146 | 146 | $response = new ImageResponse($preview, $status); |
147 | 147 | $response->setETag($file->getEtag()); |
148 | 148 | $lastModified = new \DateTime(); |
149 | 149 | $lastModified->setTimestamp($file->getMTime()); |
150 | 150 | $response->setLastModified($lastModified); |
151 | - $response->cacheFor(3600*24); |
|
151 | + $response->cacheFor(3600 * 24); |
|
152 | 152 | return $response; |
153 | 153 | } |
154 | 154 |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return array <string,array<string,string|int>>|Http\JSONResponse |
66 | 66 | */ |
67 | 67 | private function getFilesAndAlbums($location, $features, $etag, $mediatypes) { |
68 | - $files = []; |
|
69 | - $albums = []; |
|
68 | + $files = [ ]; |
|
69 | + $albums = [ ]; |
|
70 | 70 | $updated = true; |
71 | 71 | /** @var Folder $folderNode */ |
72 | 72 | list($folderPathFromRoot, $folderNode) = |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | private function fixPaths($files, $folderPathFromRoot) { |
101 | 101 | if (!empty($files)) { |
102 | 102 | foreach ($files as &$file) { |
103 | - $file['path'] = $this->getReducedPath($file['path'], $folderPathFromRoot); |
|
103 | + $file[ 'path' ] = $this->getReducedPath($file[ 'path' ], $folderPathFromRoot); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | if (is_null($filename)) { |
147 | 147 | $filename = $file->getName(); |
148 | 148 | } |
149 | - $download['name'] = $filename; |
|
149 | + $download[ 'name' ] = $filename; |
|
150 | 150 | |
151 | 151 | return $download; |
152 | 152 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } catch (ServiceException $exception) { |
118 | 118 | $code = $this->getHttpStatusCode($exception); |
119 | 119 | $url = $this->urlGenerator->linkToRoute( |
120 | - $this->appName . '.page.error_page', ['code' => $code] |
|
120 | + $this->appName.'.page.error_page', [ 'code' => $code ] |
|
121 | 121 | ); |
122 | 122 | |
123 | 123 | $response = new RedirectResponse($url); |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // That's the only exception out of all the image media types we serve |
130 | - if ($download['mimetype'] === 'image/svg+xml') { |
|
131 | - $download['mimetype'] = 'text/plain'; |
|
130 | + if ($download[ 'mimetype' ] === 'image/svg+xml') { |
|
131 | + $download[ 'mimetype' ] = 'text/plain'; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return new ImageResponse($download); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $subFolders = explode('/', $relativePath); |
43 | 43 | |
44 | 44 | if (count($subFolders) > 2) { |
45 | - $reducedPath = $currFolderPath . $subFolders[0] . '/' . array_pop($subFolders); |
|
45 | + $reducedPath = $currFolderPath.$subFolders[ 0 ].'/'.array_pop($subFolders); |
|
46 | 46 | } else { |
47 | 47 | $reducedPath = $path; |
48 | 48 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return $this->showPublicPage($token); |
127 | 127 | } else { |
128 | 128 | $url = $this->urlGenerator->linkToRoute( |
129 | - $this->appName . '.files_public.download', |
|
129 | + $this->appName.'.files_public.download', |
|
130 | 130 | [ |
131 | 131 | 'token' => $token, |
132 | 132 | 'fileId' => $node->getId(), |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @return TemplateResponse |
188 | 188 | */ |
189 | 189 | public function slideshow() { |
190 | - return new TemplateResponse($this->appName, 'slideshow', [], 'blank'); |
|
190 | + return new TemplateResponse($this->appName, 'slideshow', [ ], 'blank'); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | private function showPublicPage($token) { |
230 | 230 | $albumName = $this->environment->getSharedFolderName(); |
231 | 231 | list($server2ServerSharing, $protected) = $this->getServer2ServerProperties(); |
232 | - $downloadUrl = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', ['token' => $token]); |
|
232 | + $downloadUrl = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.downloadShare', [ 'token' => $token ]); |
|
233 | 233 | |
234 | 234 | // Parameters sent to the template |
235 | 235 | $params = [ |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | |
245 | 245 | // Will render the page using the template found in templates/public.php |
246 | 246 | $response = new PublicTemplateResponse($this->appName, 'public', $params); |
247 | - $response->setHeaderTitle($params['albumName']); |
|
248 | - $response->setHeaderDetails($this->l10n->t('shared by %s', [$params['displayName']])); |
|
247 | + $response->setHeaderTitle($params[ 'albumName' ]); |
|
248 | + $response->setHeaderDetails($this->l10n->t('shared by %s', [ $params[ 'displayName' ] ])); |
|
249 | 249 | $response->setHeaderActions([ |
250 | 250 | new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download-white', $downloadUrl, 0), |
251 | 251 | new SimpleMenuAction('download', $this->l10n->t('Download'), 'icon-download', $downloadUrl, 10), |
252 | 252 | new LinkMenuAction($this->l10n->t('Direct link'), 'icon-public', $downloadUrl), |
253 | - new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $this->environment->getUserId(), $params['displayName'], $params['albumName']) |
|
253 | + new ExternalShareMenuAction($this->l10n->t('Add to your Nextcloud'), 'icon-external', $this->environment->getUserId(), $params[ 'displayName' ], $params[ 'albumName' ]) |
|
254 | 254 | ]); |
255 | 255 | $this->addContentSecurityToResponse($response); |
256 | 256 | |
@@ -270,6 +270,6 @@ discard block |
||
270 | 270 | $password = $this->environment->getSharePassword(); |
271 | 271 | $passwordProtected = ($password) ? 'true' : 'false'; |
272 | 272 | |
273 | - return [$server2ServerSharing, $passwordProtected]; |
|
273 | + return [ $server2ServerSharing, $passwordProtected ]; |
|
274 | 274 | } |
275 | 275 | } |