Passed
Push — master ( e7a806...6dd378 )
by Roeland
22:11 queued 10:32
created
apps/theming/lib/ImageManager.php 2 patches
Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -41,271 +41,271 @@
 block discarded – undo
41 41
 
42 42
 class ImageManager {
43 43
 
44
-	/** @var IConfig */
45
-	private $config;
46
-	/** @var IAppData */
47
-	private $appData;
48
-	/** @var IURLGenerator */
49
-	private $urlGenerator;
50
-	/** @var array */
51
-	private $supportedImageKeys = ['background', 'logo', 'logoheader', 'favicon'];
52
-	/** @var ICacheFactory */
53
-	private $cacheFactory;
54
-	/** @var ILogger */
55
-	private $logger;
56
-	/** @var ITempManager */
57
-	private $tempManager;
44
+    /** @var IConfig */
45
+    private $config;
46
+    /** @var IAppData */
47
+    private $appData;
48
+    /** @var IURLGenerator */
49
+    private $urlGenerator;
50
+    /** @var array */
51
+    private $supportedImageKeys = ['background', 'logo', 'logoheader', 'favicon'];
52
+    /** @var ICacheFactory */
53
+    private $cacheFactory;
54
+    /** @var ILogger */
55
+    private $logger;
56
+    /** @var ITempManager */
57
+    private $tempManager;
58 58
 
59
-	public function __construct(IConfig $config,
60
-								IAppData $appData,
61
-								IURLGenerator $urlGenerator,
62
-								ICacheFactory $cacheFactory,
63
-								ILogger $logger,
64
-								ITempManager $tempManager
65
-	) {
66
-		$this->config = $config;
67
-		$this->appData = $appData;
68
-		$this->urlGenerator = $urlGenerator;
69
-		$this->cacheFactory = $cacheFactory;
70
-		$this->logger = $logger;
71
-		$this->tempManager = $tempManager;
72
-	}
59
+    public function __construct(IConfig $config,
60
+                                IAppData $appData,
61
+                                IURLGenerator $urlGenerator,
62
+                                ICacheFactory $cacheFactory,
63
+                                ILogger $logger,
64
+                                ITempManager $tempManager
65
+    ) {
66
+        $this->config = $config;
67
+        $this->appData = $appData;
68
+        $this->urlGenerator = $urlGenerator;
69
+        $this->cacheFactory = $cacheFactory;
70
+        $this->logger = $logger;
71
+        $this->tempManager = $tempManager;
72
+    }
73 73
 
74
-	public function getImageUrl(string $key, bool $useSvg = true): string {
75
-		$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
76
-		try {
77
-			$image = $this->getImage($key, $useSvg);
78
-			return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter;
79
-		} catch (NotFoundException $e) {
80
-		}
74
+    public function getImageUrl(string $key, bool $useSvg = true): string {
75
+        $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
76
+        try {
77
+            $image = $this->getImage($key, $useSvg);
78
+            return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter;
79
+        } catch (NotFoundException $e) {
80
+        }
81 81
 
82
-		switch ($key) {
83
-			case 'logo':
84
-			case 'logoheader':
85
-			case 'favicon':
86
-				return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter;
87
-			case 'background':
88
-				return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter;
89
-		}
90
-	}
82
+        switch ($key) {
83
+            case 'logo':
84
+            case 'logoheader':
85
+            case 'favicon':
86
+                return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter;
87
+            case 'background':
88
+                return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter;
89
+        }
90
+    }
91 91
 
92
-	public function getImageUrlAbsolute(string $key, bool $useSvg = true): string {
93
-		return $this->urlGenerator->getAbsoluteURL($this->getImageUrl($key, $useSvg));
94
-	}
92
+    public function getImageUrlAbsolute(string $key, bool $useSvg = true): string {
93
+        return $this->urlGenerator->getAbsoluteURL($this->getImageUrl($key, $useSvg));
94
+    }
95 95
 
96
-	/**
97
-	 * @param string $key
98
-	 * @param bool $useSvg
99
-	 * @return ISimpleFile
100
-	 * @throws NotFoundException
101
-	 * @throws NotPermittedException
102
-	 */
103
-	public function getImage(string $key, bool $useSvg = true): ISimpleFile {
104
-		$pngFile = null;
105
-		$logo = $this->config->getAppValue('theming', $key . 'Mime', false);
106
-		$folder = $this->appData->getFolder('images');
107
-		if ($logo === false || !$folder->fileExists($key)) {
108
-			throw new NotFoundException();
109
-		}
110
-		if (!$useSvg && $this->shouldReplaceIcons()) {
111
-			if (!$folder->fileExists($key . '.png')) {
112
-				try {
113
-					$finalIconFile = new \Imagick();
114
-					$finalIconFile->setBackgroundColor('none');
115
-					$finalIconFile->readImageBlob($folder->getFile($key)->getContent());
116
-					$finalIconFile->setImageFormat('png32');
117
-					$pngFile = $folder->newFile($key . '.png');
118
-					$pngFile->putContent($finalIconFile->getImageBlob());
119
-				} catch (\ImagickException $e) {
120
-					$this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: ' . $e->getMessage());
121
-					$pngFile = null;
122
-				}
123
-			} else {
124
-				$pngFile = $folder->getFile($key . '.png');
125
-			}
126
-		}
127
-		if ($pngFile !== null) {
128
-			return $pngFile;
129
-		}
130
-		return $folder->getFile($key);
131
-	}
96
+    /**
97
+     * @param string $key
98
+     * @param bool $useSvg
99
+     * @return ISimpleFile
100
+     * @throws NotFoundException
101
+     * @throws NotPermittedException
102
+     */
103
+    public function getImage(string $key, bool $useSvg = true): ISimpleFile {
104
+        $pngFile = null;
105
+        $logo = $this->config->getAppValue('theming', $key . 'Mime', false);
106
+        $folder = $this->appData->getFolder('images');
107
+        if ($logo === false || !$folder->fileExists($key)) {
108
+            throw new NotFoundException();
109
+        }
110
+        if (!$useSvg && $this->shouldReplaceIcons()) {
111
+            if (!$folder->fileExists($key . '.png')) {
112
+                try {
113
+                    $finalIconFile = new \Imagick();
114
+                    $finalIconFile->setBackgroundColor('none');
115
+                    $finalIconFile->readImageBlob($folder->getFile($key)->getContent());
116
+                    $finalIconFile->setImageFormat('png32');
117
+                    $pngFile = $folder->newFile($key . '.png');
118
+                    $pngFile->putContent($finalIconFile->getImageBlob());
119
+                } catch (\ImagickException $e) {
120
+                    $this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: ' . $e->getMessage());
121
+                    $pngFile = null;
122
+                }
123
+            } else {
124
+                $pngFile = $folder->getFile($key . '.png');
125
+            }
126
+        }
127
+        if ($pngFile !== null) {
128
+            return $pngFile;
129
+        }
130
+        return $folder->getFile($key);
131
+    }
132 132
 
133
-	public function getCustomImages(): array {
134
-		$images = [];
135
-		foreach ($this->supportedImageKeys as $key) {
136
-			$images[$key] = [
137
-				'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''),
138
-				'url' => $this->getImageUrl($key),
139
-			];
140
-		}
141
-		return $images;
142
-	}
133
+    public function getCustomImages(): array {
134
+        $images = [];
135
+        foreach ($this->supportedImageKeys as $key) {
136
+            $images[$key] = [
137
+                'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''),
138
+                'url' => $this->getImageUrl($key),
139
+            ];
140
+        }
141
+        return $images;
142
+    }
143 143
 
144
-	/**
145
-	 * Get folder for current theming files
146
-	 *
147
-	 * @return ISimpleFolder
148
-	 * @throws NotPermittedException
149
-	 */
150
-	public function getCacheFolder(): ISimpleFolder {
151
-		$cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
152
-		try {
153
-			$folder = $this->appData->getFolder($cacheBusterValue);
154
-		} catch (NotFoundException $e) {
155
-			$folder = $this->appData->newFolder($cacheBusterValue);
156
-			$this->cleanup();
157
-		}
158
-		return $folder;
159
-	}
144
+    /**
145
+     * Get folder for current theming files
146
+     *
147
+     * @return ISimpleFolder
148
+     * @throws NotPermittedException
149
+     */
150
+    public function getCacheFolder(): ISimpleFolder {
151
+        $cacheBusterValue = $this->config->getAppValue('theming', 'cachebuster', '0');
152
+        try {
153
+            $folder = $this->appData->getFolder($cacheBusterValue);
154
+        } catch (NotFoundException $e) {
155
+            $folder = $this->appData->newFolder($cacheBusterValue);
156
+            $this->cleanup();
157
+        }
158
+        return $folder;
159
+    }
160 160
 
161
-	/**
162
-	 * Get a file from AppData
163
-	 *
164
-	 * @param string $filename
165
-	 * @throws NotFoundException
166
-	 * @return \OCP\Files\SimpleFS\ISimpleFile
167
-	 * @throws NotPermittedException
168
-	 */
169
-	public function getCachedImage(string $filename): ISimpleFile {
170
-		$currentFolder = $this->getCacheFolder();
171
-		return $currentFolder->getFile($filename);
172
-	}
161
+    /**
162
+     * Get a file from AppData
163
+     *
164
+     * @param string $filename
165
+     * @throws NotFoundException
166
+     * @return \OCP\Files\SimpleFS\ISimpleFile
167
+     * @throws NotPermittedException
168
+     */
169
+    public function getCachedImage(string $filename): ISimpleFile {
170
+        $currentFolder = $this->getCacheFolder();
171
+        return $currentFolder->getFile($filename);
172
+    }
173 173
 
174
-	/**
175
-	 * Store a file for theming in AppData
176
-	 *
177
-	 * @param string $filename
178
-	 * @param string $data
179
-	 * @return \OCP\Files\SimpleFS\ISimpleFile
180
-	 * @throws NotFoundException
181
-	 * @throws NotPermittedException
182
-	 */
183
-	public function setCachedImage(string $filename, string $data): ISimpleFile {
184
-		$currentFolder = $this->getCacheFolder();
185
-		if ($currentFolder->fileExists($filename)) {
186
-			$file = $currentFolder->getFile($filename);
187
-		} else {
188
-			$file = $currentFolder->newFile($filename);
189
-		}
190
-		$file->putContent($data);
191
-		return $file;
192
-	}
174
+    /**
175
+     * Store a file for theming in AppData
176
+     *
177
+     * @param string $filename
178
+     * @param string $data
179
+     * @return \OCP\Files\SimpleFS\ISimpleFile
180
+     * @throws NotFoundException
181
+     * @throws NotPermittedException
182
+     */
183
+    public function setCachedImage(string $filename, string $data): ISimpleFile {
184
+        $currentFolder = $this->getCacheFolder();
185
+        if ($currentFolder->fileExists($filename)) {
186
+            $file = $currentFolder->getFile($filename);
187
+        } else {
188
+            $file = $currentFolder->newFile($filename);
189
+        }
190
+        $file->putContent($data);
191
+        return $file;
192
+    }
193 193
 
194
-	public function delete(string $key) {
195
-		/* ignore exceptions, since we don't want to fail hard if something goes wrong during cleanup */
196
-		try {
197
-			$file = $this->appData->getFolder('images')->getFile($key);
198
-			$file->delete();
199
-		} catch (NotFoundException $e) {
200
-		} catch (NotPermittedException $e) {
201
-		}
202
-		try {
203
-			$file = $this->appData->getFolder('images')->getFile($key . '.png');
204
-			$file->delete();
205
-		} catch (NotFoundException $e) {
206
-		} catch (NotPermittedException $e) {
207
-		}
208
-	}
194
+    public function delete(string $key) {
195
+        /* ignore exceptions, since we don't want to fail hard if something goes wrong during cleanup */
196
+        try {
197
+            $file = $this->appData->getFolder('images')->getFile($key);
198
+            $file->delete();
199
+        } catch (NotFoundException $e) {
200
+        } catch (NotPermittedException $e) {
201
+        }
202
+        try {
203
+            $file = $this->appData->getFolder('images')->getFile($key . '.png');
204
+            $file->delete();
205
+        } catch (NotFoundException $e) {
206
+        } catch (NotPermittedException $e) {
207
+        }
208
+    }
209 209
 
210
-	public function updateImage(string $key, string $tmpFile) {
211
-		$this->delete($key);
210
+    public function updateImage(string $key, string $tmpFile) {
211
+        $this->delete($key);
212 212
 
213
-		try {
214
-			$folder = $this->appData->getFolder('images');
215
-		} catch (NotFoundException $e) {
216
-			$folder = $this->appData->newFolder('images');
217
-		}
213
+        try {
214
+            $folder = $this->appData->getFolder('images');
215
+        } catch (NotFoundException $e) {
216
+            $folder = $this->appData->newFolder('images');
217
+        }
218 218
 
219
-		$target = $folder->newFile($key);
220
-		$supportedFormats = $this->getSupportedUploadImageFormats($key);
221
-		$detectedMimeType = mime_content_type($tmpFile);
222
-		if (!in_array($detectedMimeType, $supportedFormats, true)) {
223
-			throw new \Exception('Unsupported image type');
224
-		}
219
+        $target = $folder->newFile($key);
220
+        $supportedFormats = $this->getSupportedUploadImageFormats($key);
221
+        $detectedMimeType = mime_content_type($tmpFile);
222
+        if (!in_array($detectedMimeType, $supportedFormats, true)) {
223
+            throw new \Exception('Unsupported image type');
224
+        }
225 225
 
226
-		if ($key === 'background' && strpos($detectedMimeType, 'image/svg') === false) {
227
-			// Optimize the image since some people may upload images that will be
228
-			// either to big or are not progressive rendering.
229
-			$newImage = @imagecreatefromstring(file_get_contents($tmpFile));
226
+        if ($key === 'background' && strpos($detectedMimeType, 'image/svg') === false) {
227
+            // Optimize the image since some people may upload images that will be
228
+            // either to big or are not progressive rendering.
229
+            $newImage = @imagecreatefromstring(file_get_contents($tmpFile));
230 230
 
231
-			// Preserve transparency
232
-			imagesavealpha($newImage, true);
233
-			imagealphablending($newImage, true);
231
+            // Preserve transparency
232
+            imagesavealpha($newImage, true);
233
+            imagealphablending($newImage, true);
234 234
 
235
-			$tmpFile = $this->tempManager->getTemporaryFile();
236
-			$newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
237
-			$newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth));
238
-			$outputImage = imagescale($newImage, $newWidth, $newHeight);
235
+            $tmpFile = $this->tempManager->getTemporaryFile();
236
+            $newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
237
+            $newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth));
238
+            $outputImage = imagescale($newImage, $newWidth, $newHeight);
239 239
 
240
-			imageinterlace($outputImage, 1);
241
-			imagepng($outputImage, $tmpFile, 8);
242
-			imagedestroy($outputImage);
240
+            imageinterlace($outputImage, 1);
241
+            imagepng($outputImage, $tmpFile, 8);
242
+            imagedestroy($outputImage);
243 243
 
244
-			$target->putContent(file_get_contents($tmpFile));
245
-		} else {
246
-			$target->putContent(file_get_contents($tmpFile));
247
-		}
244
+            $target->putContent(file_get_contents($tmpFile));
245
+        } else {
246
+            $target->putContent(file_get_contents($tmpFile));
247
+        }
248 248
 
249
-		return $detectedMimeType;
250
-	}
249
+        return $detectedMimeType;
250
+    }
251 251
 
252
-	/**
253
-	 * Returns a list of supported mime types for image uploads.
254
-	 * "favicon" images are only allowed to be SVG when imagemagick with SVG support is available.
255
-	 *
256
-	 * @param string $key The image key, e.g. "favicon"
257
-	 * @return array
258
-	 */
259
-	private function getSupportedUploadImageFormats(string $key): array {
260
-		$supportedFormats = ['image/jpeg', 'image/png', 'image/gif'];
252
+    /**
253
+     * Returns a list of supported mime types for image uploads.
254
+     * "favicon" images are only allowed to be SVG when imagemagick with SVG support is available.
255
+     *
256
+     * @param string $key The image key, e.g. "favicon"
257
+     * @return array
258
+     */
259
+    private function getSupportedUploadImageFormats(string $key): array {
260
+        $supportedFormats = ['image/jpeg', 'image/png', 'image/gif'];
261 261
 
262
-		if ($key !== 'favicon' || $this->shouldReplaceIcons() === true) {
263
-			$supportedFormats[] = 'image/svg+xml';
264
-			$supportedFormats[] = 'image/svg';
265
-		}
262
+        if ($key !== 'favicon' || $this->shouldReplaceIcons() === true) {
263
+            $supportedFormats[] = 'image/svg+xml';
264
+            $supportedFormats[] = 'image/svg';
265
+        }
266 266
 
267
-		if ($key === 'favicon') {
268
-			$supportedFormats[] = 'image/x-icon';
269
-			$supportedFormats[] = 'image/vnd.microsoft.icon';
270
-		}
267
+        if ($key === 'favicon') {
268
+            $supportedFormats[] = 'image/x-icon';
269
+            $supportedFormats[] = 'image/vnd.microsoft.icon';
270
+        }
271 271
 
272
-		return $supportedFormats;
273
-	}
272
+        return $supportedFormats;
273
+    }
274 274
 
275
-	/**
276
-	 * remove cached files that are not required any longer
277
-	 *
278
-	 * @throws NotPermittedException
279
-	 * @throws NotFoundException
280
-	 */
281
-	public function cleanup() {
282
-		$currentFolder = $this->getCacheFolder();
283
-		$folders = $this->appData->getDirectoryListing();
284
-		foreach ($folders as $folder) {
285
-			if ($folder->getName() !== 'images' && $folder->getName() !== $currentFolder->getName()) {
286
-				$folder->delete();
287
-			}
288
-		}
289
-	}
275
+    /**
276
+     * remove cached files that are not required any longer
277
+     *
278
+     * @throws NotPermittedException
279
+     * @throws NotFoundException
280
+     */
281
+    public function cleanup() {
282
+        $currentFolder = $this->getCacheFolder();
283
+        $folders = $this->appData->getDirectoryListing();
284
+        foreach ($folders as $folder) {
285
+            if ($folder->getName() !== 'images' && $folder->getName() !== $currentFolder->getName()) {
286
+                $folder->delete();
287
+            }
288
+        }
289
+    }
290 290
 
291
-	/**
292
-	 * Check if Imagemagick is enabled and if SVG is supported
293
-	 * otherwise we can't render custom icons
294
-	 *
295
-	 * @return bool
296
-	 */
297
-	public function shouldReplaceIcons() {
298
-		$cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl());
299
-		if ($value = $cache->get('shouldReplaceIcons')) {
300
-			return (bool)$value;
301
-		}
302
-		$value = false;
303
-		if (extension_loaded('imagick')) {
304
-			if (count(\Imagick::queryFormats('SVG')) >= 1) {
305
-				$value = true;
306
-			}
307
-		}
308
-		$cache->set('shouldReplaceIcons', $value);
309
-		return $value;
310
-	}
291
+    /**
292
+     * Check if Imagemagick is enabled and if SVG is supported
293
+     * otherwise we can't render custom icons
294
+     *
295
+     * @return bool
296
+     */
297
+    public function shouldReplaceIcons() {
298
+        $cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl());
299
+        if ($value = $cache->get('shouldReplaceIcons')) {
300
+            return (bool)$value;
301
+        }
302
+        $value = false;
303
+        if (extension_loaded('imagick')) {
304
+            if (count(\Imagick::queryFormats('SVG')) >= 1) {
305
+                $value = true;
306
+            }
307
+        }
308
+        $cache->set('shouldReplaceIcons', $value);
309
+        return $value;
310
+    }
311 311
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
76 76
 		try {
77 77
 			$image = $this->getImage($key, $useSvg);
78
-			return $this->urlGenerator->linkToRoute('theming.Theming.getImage', [ 'key' => $key ]) . '?v=' . $cacheBusterCounter;
78
+			return $this->urlGenerator->linkToRoute('theming.Theming.getImage', ['key' => $key]).'?v='.$cacheBusterCounter;
79 79
 		} catch (NotFoundException $e) {
80 80
 		}
81 81
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 			case 'logo':
84 84
 			case 'logoheader':
85 85
 			case 'favicon':
86
-				return $this->urlGenerator->imagePath('core', 'logo/logo.png') . '?v=' . $cacheBusterCounter;
86
+				return $this->urlGenerator->imagePath('core', 'logo/logo.png').'?v='.$cacheBusterCounter;
87 87
 			case 'background':
88
-				return $this->urlGenerator->imagePath('core', 'background.png') . '?v=' . $cacheBusterCounter;
88
+				return $this->urlGenerator->imagePath('core', 'background.png').'?v='.$cacheBusterCounter;
89 89
 		}
90 90
 	}
91 91
 
@@ -102,26 +102,26 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function getImage(string $key, bool $useSvg = true): ISimpleFile {
104 104
 		$pngFile = null;
105
-		$logo = $this->config->getAppValue('theming', $key . 'Mime', false);
105
+		$logo = $this->config->getAppValue('theming', $key.'Mime', false);
106 106
 		$folder = $this->appData->getFolder('images');
107 107
 		if ($logo === false || !$folder->fileExists($key)) {
108 108
 			throw new NotFoundException();
109 109
 		}
110 110
 		if (!$useSvg && $this->shouldReplaceIcons()) {
111
-			if (!$folder->fileExists($key . '.png')) {
111
+			if (!$folder->fileExists($key.'.png')) {
112 112
 				try {
113 113
 					$finalIconFile = new \Imagick();
114 114
 					$finalIconFile->setBackgroundColor('none');
115 115
 					$finalIconFile->readImageBlob($folder->getFile($key)->getContent());
116 116
 					$finalIconFile->setImageFormat('png32');
117
-					$pngFile = $folder->newFile($key . '.png');
117
+					$pngFile = $folder->newFile($key.'.png');
118 118
 					$pngFile->putContent($finalIconFile->getImageBlob());
119 119
 				} catch (\ImagickException $e) {
120
-					$this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: ' . $e->getMessage());
120
+					$this->logger->info('The image was requested to be no SVG file, but converting it to PNG failed: '.$e->getMessage());
121 121
 					$pngFile = null;
122 122
 				}
123 123
 			} else {
124
-				$pngFile = $folder->getFile($key . '.png');
124
+				$pngFile = $folder->getFile($key.'.png');
125 125
 			}
126 126
 		}
127 127
 		if ($pngFile !== null) {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$images = [];
135 135
 		foreach ($this->supportedImageKeys as $key) {
136 136
 			$images[$key] = [
137
-				'mime' => $this->config->getAppValue('theming', $key . 'Mime', ''),
137
+				'mime' => $this->config->getAppValue('theming', $key.'Mime', ''),
138 138
 				'url' => $this->getImageUrl($key),
139 139
 			];
140 140
 		}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		} catch (NotPermittedException $e) {
201 201
 		}
202 202
 		try {
203
-			$file = $this->appData->getFolder('images')->getFile($key . '.png');
203
+			$file = $this->appData->getFolder('images')->getFile($key.'.png');
204 204
 			$file->delete();
205 205
 		} catch (NotFoundException $e) {
206 206
 		} catch (NotPermittedException $e) {
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 			imagealphablending($newImage, true);
234 234
 
235 235
 			$tmpFile = $this->tempManager->getTemporaryFile();
236
-			$newWidth = (int)(imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
237
-			$newHeight = (int)(imagesy($newImage) / (imagesx($newImage) / $newWidth));
236
+			$newWidth = (int) (imagesx($newImage) < 4096 ? imagesx($newImage) : 4096);
237
+			$newHeight = (int) (imagesy($newImage) / (imagesx($newImage) / $newWidth));
238 238
 			$outputImage = imagescale($newImage, $newWidth, $newHeight);
239 239
 
240 240
 			imageinterlace($outputImage, 1);
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
 	 * @return bool
296 296
 	 */
297 297
 	public function shouldReplaceIcons() {
298
-		$cache = $this->cacheFactory->createDistributed('theming-' . $this->urlGenerator->getBaseUrl());
298
+		$cache = $this->cacheFactory->createDistributed('theming-'.$this->urlGenerator->getBaseUrl());
299 299
 		if ($value = $cache->get('shouldReplaceIcons')) {
300
-			return (bool)$value;
300
+			return (bool) $value;
301 301
 		}
302 302
 		$value = false;
303 303
 		if (extension_loaded('imagick')) {
Please login to merge, or discard this patch.