Completed
Pull Request — master (#4617)
by Julius
14:00
created
lib/private/App/InfoParser.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			return null;
50 50
 		}
51 51
 
52
-		if(!is_null($this->cache)) {
53
-			$fileCacheKey = $file . filemtime($file);
52
+		if (!is_null($this->cache)) {
53
+			$fileCacheKey = $file.filemtime($file);
54 54
 			if ($cachedValue = $this->cache->get($fileCacheKey)) {
55 55
 				return json_decode($cachedValue, true);
56 56
 			}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			$array['activity']['providers'] = $array['activity']['providers']['provider'];
167 167
 		}
168 168
 
169
-		if(!is_null($this->cache)) {
169
+		if (!is_null($this->cache)) {
170 170
 			$this->cache->set($fileCacheKey, json_encode($array));
171 171
 		}
172 172
 		return $array;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	function xmlToArray($xml) {
180 180
 		if (!$xml->children()) {
181
-			return (string)$xml;
181
+			return (string) $xml;
182 182
 		}
183 183
 
184 184
 		$array = [];
@@ -194,16 +194,16 @@  discard block
 block discarded – undo
194 194
 				$data = [
195 195
 					'@attributes' => [],
196 196
 				];
197
-				if (!count($node->children())){
198
-					$value = (string)$node;
197
+				if (!count($node->children())) {
198
+					$value = (string) $node;
199 199
 					if (!empty($value)) {
200
-						$data['@value'] = (string)$node;
200
+						$data['@value'] = (string) $node;
201 201
 					}
202 202
 				} else {
203 203
 					$data = array_merge($data, $this->xmlToArray($node));
204 204
 				}
205 205
 				foreach ($attributes as $attr => $value) {
206
-					$data['@attributes'][$attr] = (string)$value;
206
+					$data['@attributes'][$attr] = (string) $value;
207 207
 				}
208 208
 
209 209
 				if ($totalElement > 1) {
Please login to merge, or discard this patch.
lib/private/App/PlatformRepository.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 					break;
91 91
 
92 92
 				case 'openssl':
93
-					$prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function ($match) {
94
-						return $match[1] . (empty($match[2]) ? '' : '.' . (ord($match[2]) - 96));
93
+					$prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function($match) {
94
+						return $match[1].(empty($match[2]) ? '' : '.'.(ord($match[2]) - 96));
95 95
 					}, OPENSSL_VERSION_TEXT);
96 96
 					break;
97 97
 
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 			return '9999999-dev';
167 167
 		}
168 168
 		if ('dev-' === strtolower(substr($version, 0, 4))) {
169
-			return 'dev-' . substr($version, 4);
169
+			return 'dev-'.substr($version, 4);
170 170
 		}
171 171
 		// match classical versioning
172
-		if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?' . self::$modifierRegex . '$}i', $version, $matches)) {
172
+		if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) {
173 173
 			$version = $matches[1]
174 174
 				. (!empty($matches[2]) ? $matches[2] : '.0')
175 175
 				. (!empty($matches[3]) ? $matches[3] : '.0')
176 176
 				. (!empty($matches[4]) ? $matches[4] : '.0');
177 177
 			$index = 5;
178
-		} elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) { // match date-based versioning
178
+		} elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)'.self::$modifierRegex.'$}i', $version, $matches)) { // match date-based versioning
179 179
 			$version = preg_replace('{\D}', '-', $matches[1]);
180 180
 			$index = 2;
181
-		} elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?' . self::$modifierRegex . '$}i', $version, $matches)) {
181
+		} elseif (preg_match('{^v?(\d{4,})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) {
182 182
 			$version = $matches[1]
183 183
 				. (!empty($matches[2]) ? $matches[2] : '.0')
184 184
 				. (!empty($matches[3]) ? $matches[3] : '.0')
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				if ('stable' === $matches[$index]) {
192 192
 					return $version;
193 193
 				}
194
-				$version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? $matches[$index + 1] : '');
194
+				$version .= '-'.$this->expandStability($matches[$index]).(!empty($matches[$index + 1]) ? $matches[$index + 1] : '');
195 195
 			}
196 196
 			if (!empty($matches[$index + 2])) {
197 197
 				$version .= '-dev';
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 			return $version;
200 200
 		}
201 201
 		$extraMessage = '';
202
-		if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
203
-			$extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
204
-		} elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
205
-			$extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
202
+		if (preg_match('{ +as +'.preg_quote($version).'$}', $fullVersion)) {
203
+			$extraMessage = ' in "'.$fullVersion.'", the alias must be an exact version';
204
+		} elseif (preg_match('{^'.preg_quote($version).' +as +}', $fullVersion)) {
205
+			$extraMessage = ' in "'.$fullVersion.'", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
206 206
 		}
207
-		throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
207
+		throw new \UnexpectedValueException('Invalid version string "'.$version.'"'.$extraMessage);
208 208
 	}
209 209
 
210 210
 	/**
Please login to merge, or discard this patch.
lib/private/DateTimeFormatter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @return string Formatted date and time string
238 238
 	 */
239 239
 	public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
240
-		return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l);
240
+		return $this->format($timestamp, 'datetime', $formatDate.'|'.$formatTime, $timeZone, $l);
241 241
 	}
242 242
 
243 243
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			$formatDate .= '^';
257 257
 		}
258 258
 
259
-		return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l);
259
+		return $this->format($timestamp, 'datetime', $formatDate.'|'.$formatTime, $timeZone, $l);
260 260
 	}
261 261
 
262 262
 	/**
Please login to merge, or discard this patch.
lib/private/Preview/WatcherConnector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,15 +56,15 @@
 block discarded – undo
56 56
 	public function connectWatcher() {
57 57
 		// Do not connect if we are not setup yet!
58 58
 		if ($this->config->getValue('instanceid', null) !== null) {
59
-			$this->root->listen('\OC\Files', 'postWrite', function (Node $node) {
59
+			$this->root->listen('\OC\Files', 'postWrite', function(Node $node) {
60 60
 				$this->getWatcher()->postWrite($node);
61 61
 			});
62 62
 
63
-			$this->root->listen('\OC\Files', 'preDelete', function (Node $node) {
63
+			$this->root->listen('\OC\Files', 'preDelete', function(Node $node) {
64 64
 				$this->getWatcher()->preDelete($node);
65 65
 			});
66 66
 
67
-			$this->root->listen('\OC\Files', 'postDelete', function (Node $node) {
67
+			$this->root->listen('\OC\Files', 'postDelete', function(Node $node) {
68 68
 				$this->getWatcher()->postDelete($node);
69 69
 			});
70 70
 		}
Please login to merge, or discard this patch.
lib/private/Preview/TXT.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
48 48
 		$content = $fileview->fopen($path, 'r');
49
-		$content = stream_get_contents($content,3000);
49
+		$content = stream_get_contents($content, 3000);
50 50
 
51 51
 		//don't create previews of empty text files
52
-		if(trim($content) === '') {
52
+		if (trim($content) === '') {
53 53
 			return false;
54 54
 		}
55 55
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$canUseTTF = function_exists('imagettftext');
70 70
 
71
-		foreach($lines as $index => $line) {
71
+		foreach ($lines as $index => $line) {
72 72
 			$index = $index + 1;
73 73
 
74 74
 			$x = (int) 1;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				imagestring($image, 1, $x, $y, $line, $textColor);
82 82
 			}
83 83
 
84
-			if(($index * $lineSize) >= $maxY) {
84
+			if (($index * $lineSize) >= $maxY) {
85 85
 				break;
86 86
 			}
87 87
 		}
Please login to merge, or discard this patch.
lib/private/Preview/Bitmap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		try {
49 49
 			$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
50 50
 		} catch (\Exception $e) {
51
-			\OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getmessage(), \OCP\Util::ERROR);
51
+			\OCP\Util::writeLog('core', 'ImageMagick says: '.$e->getmessage(), \OCP\Util::ERROR);
52 52
 			return false;
53 53
 		}
54 54
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		$bp = new Imagick();
80 80
 
81 81
 		// Layer 0 contains either the bitmap or a flat representation of all vector layers
82
-		$bp->readImage($tmpPath . '[0]');
82
+		$bp->readImage($tmpPath.'[0]');
83 83
 
84 84
 		$bp = $this->resize($bp, $maxX, $maxY);
85 85
 
Please login to merge, or discard this patch.
lib/private/Preview/Office.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,20 +41,20 @@
 block discarded – undo
41 41
 
42 42
 		$tmpDir = \OC::$server->getTempManager()->getTempBaseDir();
43 43
 
44
-		$defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
44
+		$defaultParameters = ' -env:UserInstallation=file://'.escapeshellarg($tmpDir.'/owncloud-'.\OC_Util::getInstanceId().'/').' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
45 45
 		$clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
46 46
 
47
-		$exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
47
+		$exec = $this->cmd.$clParameters.escapeshellarg($tmpDir).' '.escapeshellarg($absPath);
48 48
 
49 49
 		shell_exec($exec);
50 50
 
51 51
 		//create imagick object from pdf
52 52
 		$pdfPreview = null;
53 53
 		try {
54
-			list($dirname, , , $filename) = array_values(pathinfo($absPath));
55
-			$pdfPreview = $dirname . '/' . $filename . '.pdf';
54
+			list($dirname,,, $filename) = array_values(pathinfo($absPath));
55
+			$pdfPreview = $dirname.'/'.$filename.'.pdf';
56 56
 
57
-			$pdf = new \imagick($pdfPreview . '[0]');
57
+			$pdf = new \imagick($pdfPreview.'[0]');
58 58
 			$pdf->setImageFormat('jpg');
59 59
 		} catch (\Exception $e) {
60 60
 			unlink($absPath);
Please login to merge, or discard this patch.
lib/private/Preview/Movie.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -84,15 +84,15 @@
 block discarded – undo
84 84
 		$tmpPath = \OC::$server->getTempManager()->getTemporaryFile();
85 85
 
86 86
 		if (self::$avconvBinary) {
87
-			$cmd = self::$avconvBinary . ' -y -ss ' . escapeshellarg($second) .
88
-				' -i ' . escapeshellarg($absPath) .
89
-				' -an -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
87
+			$cmd = self::$avconvBinary.' -y -ss '.escapeshellarg($second).
88
+				' -i '.escapeshellarg($absPath).
89
+				' -an -f mjpeg -vframes 1 -vsync 1 '.escapeshellarg($tmpPath).
90 90
 				' > /dev/null 2>&1';
91 91
 		} else {
92
-			$cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
93
-				' -i ' . escapeshellarg($absPath) .
94
-				' -f mjpeg -vframes 1' .
95
-				' ' . escapeshellarg($tmpPath) .
92
+			$cmd = self::$ffmpegBinary.' -y -ss '.escapeshellarg($second).
93
+				' -i '.escapeshellarg($absPath).
94
+				' -f mjpeg -vframes 1'.
95
+				' '.escapeshellarg($tmpPath).
96 96
 				' > /dev/null 2>&1';
97 97
 		}
98 98
 
Please login to merge, or discard this patch.
lib/private/Preview/SVG.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
 			$content = stream_get_contents($fileview->fopen($path, 'r'));
44 44
 			if (substr($content, 0, 5) !== '<?xml') {
45
-				$content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content;
45
+				$content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$content;
46 46
 			}
47 47
 
48 48
 			// Do not parse SVG files with references
Please login to merge, or discard this patch.