Passed
Push — master ( 0e1c9a...b65d9e )
by Daniel
15:48 queued 10s
created
apps/theming/lib/ImageManager.php 1 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.