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