Passed
Push — master ( bbba7b...22edb6 )
by Blizzz
09:41 queued 12s
created
lib/private/AppFramework/Http/Request.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @param string $stream
139 139
 	 * @see http://www.php.net/manual/en/reserved.variables.php
140 140
 	 */
141
-	public function __construct(array $vars= [],
141
+	public function __construct(array $vars = [],
142 142
 								ISecureRandom $secureRandom = null,
143 143
 								IConfig $config,
144 144
 								CsrfTokenManager $csrfTokenManager = null,
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 		$this->config = $config;
150 150
 		$this->csrfTokenManager = $csrfTokenManager;
151 151
 
152
-		if(!array_key_exists('method', $vars)) {
152
+		if (!array_key_exists('method', $vars)) {
153 153
 			$vars['method'] = 'GET';
154 154
 		}
155 155
 
156
-		foreach($this->allowedKeys as $name) {
156
+		foreach ($this->allowedKeys as $name) {
157 157
 			$this->items[$name] = isset($vars[$name])
158 158
 				? $vars[$name]
159 159
 				: [];
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
 	 * @return mixed|null
264 264
 	 */
265 265
 	public function __get($name) {
266
-		switch($name) {
266
+		switch ($name) {
267 267
 			case 'put':
268 268
 			case 'patch':
269 269
 			case 'get':
270 270
 			case 'post':
271
-				if($this->method !== strtoupper($name)) {
271
+				if ($this->method !== strtoupper($name)) {
272 272
 					throw new \LogicException(sprintf('%s cannot be accessed in a %s request.', $name, $this->method));
273 273
 				}
274 274
 				return $this->getContent();
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	public function getHeader(string $name): string {
321 321
 
322
-		$name = strtoupper(str_replace('-', '_',$name));
323
-		if (isset($this->server['HTTP_' . $name])) {
324
-			return $this->server['HTTP_' . $name];
322
+		$name = strtoupper(str_replace('-', '_', $name));
323
+		if (isset($this->server['HTTP_'.$name])) {
324
+			return $this->server['HTTP_'.$name];
325 325
 		}
326 326
 
327 327
 		// There's a few headers that seem to end up in the top-level
@@ -447,21 +447,21 @@  discard block
 block discarded – undo
447 447
 		// 'application/json' must be decoded manually.
448 448
 		if (strpos($this->getHeader('Content-Type'), 'application/json') !== false) {
449 449
 			$params = json_decode(file_get_contents($this->inputStream), true);
450
-			if($params !== null && \count($params) > 0) {
450
+			if ($params !== null && \count($params) > 0) {
451 451
 				$this->items['params'] = $params;
452
-				if($this->method === 'POST') {
452
+				if ($this->method === 'POST') {
453 453
 					$this->items['post'] = $params;
454 454
 				}
455 455
 			}
456 456
 
457 457
 		// Handle application/x-www-form-urlencoded for methods other than GET
458 458
 		// or post correctly
459
-		} elseif($this->method !== 'GET'
459
+		} elseif ($this->method !== 'GET'
460 460
 				&& $this->method !== 'POST'
461 461
 				&& strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') !== false) {
462 462
 
463 463
 			parse_str(file_get_contents($this->inputStream), $params);
464
-			if(\is_array($params)) {
464
+			if (\is_array($params)) {
465 465
 				$this->items['params'] = $params;
466 466
 			}
467 467
 		}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 * @return bool true if CSRF check passed
479 479
 	 */
480 480
 	public function passesCSRFCheck(): bool {
481
-		if($this->csrfTokenManager === null) {
481
+		if ($this->csrfTokenManager === null) {
482 482
 			return false;
483 483
 		}
484 484
 
485
-		if(!$this->passesStrictCookieCheck()) {
485
+		if (!$this->passesStrictCookieCheck()) {
486 486
 			return false;
487 487
 		}
488 488
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 		if ($this->getHeader('OCS-APIREQUEST')) {
511 511
 			return false;
512 512
 		}
513
-		if($this->getCookie(session_name()) === null && $this->getCookie('nc_token') === null) {
513
+		if ($this->getCookie(session_name()) === null && $this->getCookie('nc_token') === null) {
514 514
 			return false;
515 515
 		}
516 516
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	protected function getProtectedCookieName(string $name): string {
536 536
 		$cookieParams = $this->getCookieParams();
537 537
 		$prefix = '';
538
-		if($cookieParams['secure'] === true && $cookieParams['path'] === '/') {
538
+		if ($cookieParams['secure'] === true && $cookieParams['path'] === '/') {
539 539
 			$prefix = '__Host-';
540 540
 		}
541 541
 
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
 	 * @since 9.1.0
551 551
 	 */
552 552
 	public function passesStrictCookieCheck(): bool {
553
-		if(!$this->cookieCheckRequired()) {
553
+		if (!$this->cookieCheckRequired()) {
554 554
 			return true;
555 555
 		}
556 556
 
557 557
 		$cookieName = $this->getProtectedCookieName('nc_sameSiteCookiestrict');
558
-		if($this->getCookie($cookieName) === 'true'
558
+		if ($this->getCookie($cookieName) === 'true'
559 559
 			&& $this->passesLaxCookieCheck()) {
560 560
 			return true;
561 561
 		}
@@ -570,12 +570,12 @@  discard block
 block discarded – undo
570 570
 	 * @since 9.1.0
571 571
 	 */
572 572
 	public function passesLaxCookieCheck(): bool {
573
-		if(!$this->cookieCheckRequired()) {
573
+		if (!$this->cookieCheckRequired()) {
574 574
 			return true;
575 575
 		}
576 576
 
577 577
 		$cookieName = $this->getProtectedCookieName('nc_sameSiteCookielax');
578
-		if($this->getCookie($cookieName) === 'true') {
578
+		if ($this->getCookie($cookieName) === 'true') {
579 579
 			return true;
580 580
 		}
581 581
 		return false;
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
 	 * @return string
589 589
 	 */
590 590
 	public function getId(): string {
591
-		if(isset($this->server['UNIQUE_ID'])) {
591
+		if (isset($this->server['UNIQUE_ID'])) {
592 592
 			return $this->server['UNIQUE_ID'];
593 593
 		}
594 594
 
595
-		if(empty($this->requestId)) {
596
-			$validChars = ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS;
595
+		if (empty($this->requestId)) {
596
+			$validChars = ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS;
597 597
 			$this->requestId = $this->secureRandom->generate(20, $validChars);
598 598
 		}
599 599
 
@@ -649,15 +649,15 @@  discard block
 block discarded – undo
649 649
 		$remoteAddress = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
650 650
 		$trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
651 651
 
652
-		if(\is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress)) {
652
+		if (\is_array($trustedProxies) && $this->isTrustedProxy($trustedProxies, $remoteAddress)) {
653 653
 			$forwardedForHeaders = $this->config->getSystemValue('forwarded_for_headers', [
654 654
 				'HTTP_X_FORWARDED_FOR'
655 655
 				// only have one default, so we cannot ship an insecure product out of the box
656 656
 			]);
657 657
 
658
-			foreach($forwardedForHeaders as $header) {
659
-				if(isset($this->server[$header])) {
660
-					foreach(explode(',', $this->server[$header]) as $IP) {
658
+			foreach ($forwardedForHeaders as $header) {
659
+				if (isset($this->server[$header])) {
660
+					foreach (explode(',', $this->server[$header]) as $IP) {
661 661
 						$IP = trim($IP);
662 662
 						if (filter_var($IP, FILTER_VALIDATE_IP) !== false) {
663 663
 							return $IP;
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 	 * @return bool
677 677
 	 */
678 678
 	private function isOverwriteCondition(string $type = ''): bool {
679
-		$regex = '/' . $this->config->getSystemValue('overwritecondaddr', '')  . '/';
679
+		$regex = '/'.$this->config->getSystemValue('overwritecondaddr', '').'/';
680 680
 		$remoteAddr = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
681 681
 		return $regex === '//' || preg_match($regex, $remoteAddr) === 1
682 682
 		|| $type !== 'protocol';
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @return string Server protocol (http or https)
689 689
 	 */
690 690
 	public function getServerProtocol(): string {
691
-		if($this->config->getSystemValue('overwriteprotocol') !== ''
691
+		if ($this->config->getSystemValue('overwriteprotocol') !== ''
692 692
 			&& $this->isOverwriteCondition('protocol')) {
693 693
 			return $this->config->getSystemValue('overwriteprotocol');
694 694
 		}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 			'HTTP/2',
735 735
 		];
736 736
 
737
-		if(\in_array($claimedProtocol, $validProtocols, true)) {
737
+		if (\in_array($claimedProtocol, $validProtocols, true)) {
738 738
 			return $claimedProtocol;
739 739
 		}
740 740
 
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
 	 */
749 749
 	public function getRequestUri(): string {
750 750
 		$uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : '';
751
-		if($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
752
-			$uri = $this->getScriptName() . substr($uri, \strlen($this->server['SCRIPT_NAME']));
751
+		if ($this->config->getSystemValue('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
752
+			$uri = $this->getScriptName().substr($uri, \strlen($this->server['SCRIPT_NAME']));
753 753
 		}
754 754
 		return $uri;
755 755
 	}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		// FIXME: Sabre does not really belong here
777 777
 		list($path, $name) = \Sabre\Uri\split($scriptName);
778 778
 		if (!empty($path)) {
779
-			if($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) {
779
+			if ($path === $pathInfo || strpos($pathInfo, $path.'/') === 0) {
780 780
 				$pathInfo = substr($pathInfo, \strlen($path));
781 781
 			} else {
782 782
 				throw new \Exception("The requested uri($requestUri) cannot be processed by the script '$scriptName')");
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 		if ($name !== '' && strpos($pathInfo, $name) === 0) {
793 793
 			$pathInfo = substr($pathInfo, \strlen($name));
794 794
 		}
795
-		if($pathInfo === false || $pathInfo === '/'){
795
+		if ($pathInfo === false || $pathInfo === '/') {
796 796
 			return '';
797 797
 		} else {
798 798
 			return $pathInfo;
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 		$pathInfo = rawurldecode($pathInfo);
811 811
 		$encoding = mb_detect_encoding($pathInfo, ['UTF-8', 'ISO-8859-1']);
812 812
 
813
-		switch($encoding) {
813
+		switch ($encoding) {
814 814
 			case 'ISO-8859-1' :
815 815
 				$pathInfo = utf8_encode($pathInfo);
816 816
 		}
@@ -826,12 +826,12 @@  discard block
 block discarded – undo
826 826
 	 */
827 827
 	public function getScriptName(): string {
828 828
 		$name = $this->server['SCRIPT_NAME'];
829
-		$overwriteWebRoot =  $this->config->getSystemValue('overwritewebroot');
829
+		$overwriteWebRoot = $this->config->getSystemValue('overwritewebroot');
830 830
 		if ($overwriteWebRoot !== '' && $this->isOverwriteCondition()) {
831 831
 			// FIXME: This code is untestable due to __DIR__, also that hardcoded path is really dangerous
832 832
 			$serverRoot = str_replace('\\', '/', substr(__DIR__, 0, -\strlen('lib/private/appframework/http/')));
833 833
 			$suburi = str_replace('\\', '/', substr(realpath($this->server['SCRIPT_FILENAME']), \strlen($serverRoot)));
834
-			$name = '/' . ltrim($overwriteWebRoot . $suburi, '/');
834
+			$name = '/'.ltrim($overwriteWebRoot.$suburi, '/');
835 835
 		}
836 836
 		return $name;
837 837
 	}
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 			return $host;
907 907
 		}
908 908
 
909
-		$trustedList = (array)$this->config->getSystemValue('trusted_domains', []);
909
+		$trustedList = (array) $this->config->getSystemValue('trusted_domains', []);
910 910
 		if (count($trustedList) > 0) {
911 911
 			return reset($trustedList);
912 912
 		}
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	 * isn't met
922 922
 	 */
923 923
 	private function getOverwriteHost() {
924
-		if($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) {
924
+		if ($this->config->getSystemValue('overwritehost') !== '' && $this->isOverwriteCondition()) {
925 925
 			return $this->config->getSystemValue('overwritehost');
926 926
 		}
927 927
 		return null;
Please login to merge, or discard this patch.
lib/private/Group/Backend.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function getSupportedActions() {
55 55
 		$actions = 0;
56
-		foreach($this->possibleActions AS $action => $methodName) {
57
-			if(method_exists($this, $methodName)) {
56
+		foreach ($this->possibleActions AS $action => $methodName) {
57
+			if (method_exists($this, $methodName)) {
58 58
 				$actions |= $action;
59 59
 			}
60 60
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * compared with \OC\Group\Backend::CREATE_GROUP etc.
72 72
 	 */
73 73
 	public function implementsActions($actions) {
74
-		return (bool)($this->getSupportedActions() & $actions);
74
+		return (bool) ($this->getSupportedActions() & $actions);
75 75
 	}
76 76
 
77 77
 	/**
Please login to merge, or discard this patch.
lib/private/legacy/template/functions.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
  * @param string $opts, additional optional options
48 48
  */
49 49
 function emit_css_tag($href, $opts = '') {
50
-	$s='<link rel="stylesheet"';
50
+	$s = '<link rel="stylesheet"';
51 51
 	if (!empty($href)) {
52
-		$s.=' href="' . $href .'"';
52
+		$s .= ' href="'.$href.'"';
53 53
 	}
54 54
 	if (!empty($opts)) {
55
-		$s.=' '.$opts;
55
+		$s .= ' '.$opts;
56 56
 	}
57 57
 	print_unescaped($s.">\n");
58 58
 }
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
  * @param array $obj all the script information from template
63 63
  */
64 64
 function emit_css_loading_tags($obj) {
65
-	foreach($obj['cssfiles'] as $css) {
65
+	foreach ($obj['cssfiles'] as $css) {
66 66
 		emit_css_tag($css);
67 67
 	}
68
-	foreach($obj['printcssfiles'] as $css) {
68
+	foreach ($obj['printcssfiles'] as $css) {
69 69
 		emit_css_tag($css, 'media="print"');
70 70
 	}
71 71
 }
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
  * @param string $src the source URL, ignored when empty
76 76
  * @param string $script_content the inline script content, ignored when empty
77 77
  */
78
-function emit_script_tag($src, $script_content='') {
79
-	$defer_str=' defer';
80
-	$s='<script nonce="' . \OC::$server->getContentSecurityPolicyNonceManager()->getNonce() . '"';
78
+function emit_script_tag($src, $script_content = '') {
79
+	$defer_str = ' defer';
80
+	$s = '<script nonce="'.\OC::$server->getContentSecurityPolicyNonceManager()->getNonce().'"';
81 81
 	if (!empty($src)) {
82 82
 		 // emit script tag for deferred loading from $src
83
-		$s.=$defer_str.' src="' . $src .'">';
83
+		$s .= $defer_str.' src="'.$src.'">';
84 84
 	} else if (!empty($script_content)) {
85 85
 		// emit script tag for inline script from $script_content without defer (see MDN)
86
-		$s.=">\n".$script_content."\n";
86
+		$s .= ">\n".$script_content."\n";
87 87
 	} else {
88 88
 		// no $src nor $src_content, really useless empty tag
89
-		$s.='>';
89
+		$s .= '>';
90 90
 	}
91
-	$s.='</script>';
91
+	$s .= '</script>';
92 92
 	print_unescaped($s."\n");
93 93
 }
94 94
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  * @param array $obj all the script information from template
98 98
  */
99 99
 function emit_script_loading_tags($obj) {
100
-	foreach($obj['jsfiles'] as $jsfile) {
100
+	foreach ($obj['jsfiles'] as $jsfile) {
101 101
 		emit_script_tag($jsfile, '');
102 102
 	}
103 103
 	if (!empty($obj['inline_ocjs'])) {
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
  * if an array is given it will add all scripts
122 122
  */
123 123
 function script($app, $file = null) {
124
-	if(is_array($file)) {
125
-		foreach($file as $f) {
124
+	if (is_array($file)) {
125
+		foreach ($file as $f) {
126 126
 			OC_Util::addScript($app, $f);
127 127
 		}
128 128
 	} else {
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
  * if an array is given it will add all scripts
138 138
  */
139 139
 function vendor_script($app, $file = null) {
140
-	if(is_array($file)) {
141
-		foreach($file as $f) {
140
+	if (is_array($file)) {
141
+		foreach ($file as $f) {
142 142
 			OC_Util::addVendorScript($app, $f);
143 143
 		}
144 144
 	} else {
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
  * if an array is given it will add all styles
154 154
  */
155 155
 function style($app, $file = null) {
156
-	if(is_array($file)) {
157
-		foreach($file as $f) {
156
+	if (is_array($file)) {
157
+		foreach ($file as $f) {
158 158
 			OC_Util::addStyle($app, $f);
159 159
 		}
160 160
 	} else {
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
  * if an array is given it will add all styles
170 170
  */
171 171
 function vendor_style($app, $file = null) {
172
-	if(is_array($file)) {
173
-		foreach($file as $f) {
172
+	if (is_array($file)) {
173
+		foreach ($file as $f) {
174 174
 			OC_Util::addVendorStyle($app, $f);
175 175
 		}
176 176
 	} else {
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
  * if an array is given it will add all components
195 195
  */
196 196
 function component($app, $file) {
197
-	if(is_array($file)) {
198
-		foreach($file as $f) {
199
-			$url = link_to($app, 'component/' . $f . '.html');
197
+	if (is_array($file)) {
198
+		foreach ($file as $f) {
199
+			$url = link_to($app, 'component/'.$f.'.html');
200 200
 			OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]);
201 201
 		}
202 202
 	} else {
203
-		$url = link_to($app, 'component/' . $file . '.html');
203
+		$url = link_to($app, 'component/'.$file.'.html');
204 204
 		OC_Util::addHeader('link', ['rel' => 'import', 'href' => $url]);
205 205
 	}
206 206
 }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
  *
215 215
  * For further information have a look at \OCP\IURLGenerator::linkTo
216 216
  */
217
-function link_to( $app, $file, $args = [] ) {
217
+function link_to($app, $file, $args = []) {
218 218
 	return \OC::$server->getURLGenerator()->linkTo($app, $file, $args);
219 219
 }
220 220
 
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
  *
235 235
  * For further information have a look at \OCP\IURLGenerator::imagePath
236 236
  */
237
-function image_path( $app, $image ) {
238
-	return \OC::$server->getURLGenerator()->imagePath( $app, $image );
237
+function image_path($app, $image) {
238
+	return \OC::$server->getURLGenerator()->imagePath($app, $image);
239 239
 }
240 240
 
241 241
 /**
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
  * @param string $mimetype mimetype
244 244
  * @return string link to the image
245 245
  */
246
-function mimetype_icon( $mimetype ) {
247
-	return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype );
246
+function mimetype_icon($mimetype) {
247
+	return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype);
248 248
 }
249 249
 
250 250
 /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
  * @param string $path path of file
254 254
  * @return string link to the preview
255 255
  */
256
-function preview_icon( $path ) {
256
+function preview_icon($path) {
257 257
 	return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]);
258 258
 }
259 259
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
  * @param string $token
263 263
  * @return string
264 264
  */
265
-function publicPreview_icon ( $path, $token ) {
265
+function publicPreview_icon($path, $token) {
266 266
 	return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 'token' => $token]);
267 267
 }
268 268
 
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
  *
274 274
  * For further information have a look at OC_Helper::humanFileSize
275 275
  */
276
-function human_file_size( $bytes ) {
277
-	return OC_Helper::humanFileSize( $bytes );
276
+function human_file_size($bytes) {
277
+	return OC_Helper::humanFileSize($bytes);
278 278
 }
279 279
 
280 280
 /**
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
  * @param int $timestamp UNIX timestamp to strip
283 283
  * @return int timestamp without time value
284 284
  */
285
-function strip_time($timestamp){
285
+function strip_time($timestamp) {
286 286
 	$date = new \DateTime("@{$timestamp}");
287 287
 	$date->setTime(0, 0, 0);
288
-	return (int)$date->format('U');
288
+	return (int) $date->format('U');
289 289
 }
290 290
 
291 291
 /**
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 	/** @var \OC\DateTimeFormatter $formatter */
301 301
 	$formatter = \OC::$server->query('DateTimeFormatter');
302 302
 
303
-	if ($dateOnly){
303
+	if ($dateOnly) {
304 304
 		return $formatter->formatDateSpan($timestamp, $fromTime);
305 305
 	}
306 306
 	return $formatter->formatTimeSpan($timestamp, $fromTime);
307 307
 }
308 308
 
309
-function html_select_options($options, $selected, $params=[]) {
309
+function html_select_options($options, $selected, $params = []) {
310 310
 	if (!is_array($selected)) {
311
-		$selected=[$selected];
311
+		$selected = [$selected];
312 312
 	}
313 313
 	if (isset($params['combine']) && $params['combine']) {
314 314
 		$options = array_combine($options, $options);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 		$label_name = $params['label'];
322 322
 	}
323 323
 	$html = '';
324
-	foreach($options as $value => $label) {
324
+	foreach ($options as $value => $label) {
325 325
 		if ($value_name && is_array($label)) {
326 326
 			$value = $label[$value_name];
327 327
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 			$label = $label[$label_name];
330 330
 		}
331 331
 		$select = in_array($value, $selected) ? ' selected="selected"' : '';
332
-		$html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n";
332
+		$html .= '<option value="'.\OCP\Util::sanitizeHTML($value).'"'.$select.'>'.\OCP\Util::sanitizeHTML($label).'</option>'."\n";
333 333
 	}
334 334
 	return $html;
335 335
 }
Please login to merge, or discard this patch.
lib/private/Tagging/TagMapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	 * @return array An array of Tag objects.
53 53
 	 */
54 54
 	public function loadTags($owners, $type) {
55
-		if(!is_array($owners)) {
55
+		if (!is_array($owners)) {
56 56
 			$owners = [$owners];
57 57
 		}
58 58
 
59
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
60
-			. 'WHERE `uid` IN (' . str_repeat('?,', count($owners)-1) . '?) AND `type` = ? ORDER BY `category`';
59
+		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` '
60
+			. 'WHERE `uid` IN ('.str_repeat('?,', count($owners) - 1).'?) AND `type` = ? ORDER BY `category`';
61 61
 		return $this->findEntities($sql, array_merge($owners, [$type]));
62 62
 	}
63 63
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return bool
69 69
 	 */
70 70
 	public function tagExists($tag) {
71
-		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `' . $this->getTableName() . '` '
71
+		$sql = 'SELECT `id`, `uid`, `type`, `category` FROM `'.$this->getTableName().'` '
72 72
 			. 'WHERE `uid` = ? AND `type` = ? AND `category` = ?';
73 73
 		try {
74 74
 			$this->findEntity($sql, [$tag->getOwner(), $tag->getType(), $tag->getName()]);
Please login to merge, or discard this patch.
lib/private/Tags.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		}
137 137
 		$this->tags = $this->mapper->loadTags($this->owners, $this->type);
138 138
 
139
-		if(count($defaultTags) > 0 && count($this->tags) === 0) {
139
+		if (count($defaultTags) > 0 && count($this->tags) === 0) {
140 140
 			$this->addMultiple($defaultTags, true);
141 141
 		}
142 142
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return array
178 178
 	 */
179 179
 	public function getTags() {
180
-		if(!count($this->tags)) {
180
+		if (!count($this->tags)) {
181 181
 			return [];
182 182
 		}
183 183
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 		});
187 187
 		$tagMap = [];
188 188
 
189
-		foreach($this->tags as $tag) {
190
-			if($tag->getName() !== ITags::TAG_FAVORITE) {
189
+		foreach ($this->tags as $tag) {
190
+			if ($tag->getName() !== ITags::TAG_FAVORITE) {
191 191
 				$tagMap[] = $this->tagMap($tag);
192 192
 			}
193 193
 		}
@@ -225,25 +225,25 @@  discard block
 block discarded – undo
225 225
 			$chunks = array_chunk($objIds, 900, false);
226 226
 			foreach ($chunks as $chunk) {
227 227
 				$result = $conn->executeQuery(
228
-					'SELECT `category`, `categoryid`, `objid` ' .
229
-					'FROM `' . self::RELATION_TABLE . '` r, `' . self::TAG_TABLE . '` ' .
228
+					'SELECT `category`, `categoryid`, `objid` '.
229
+					'FROM `'.self::RELATION_TABLE.'` r, `'.self::TAG_TABLE.'` '.
230 230
 					'WHERE `categoryid` = `id` AND `uid` = ? AND r.`type` = ? AND `objid` IN (?)',
231 231
 					[$this->user, $this->type, $chunk],
232 232
 					[null, null, IQueryBuilder::PARAM_INT_ARRAY]
233 233
 				);
234 234
 				while ($row = $result->fetch()) {
235
-					$objId = (int)$row['objid'];
235
+					$objId = (int) $row['objid'];
236 236
 					if (!isset($entries[$objId])) {
237 237
 						$entries[$objId] = [];
238 238
 					}
239 239
 					$entries[$objId][] = $row['category'];
240 240
 				}
241 241
 				if ($result === null) {
242
-					\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
242
+					\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
243 243
 					return false;
244 244
 				}
245 245
 			}
246
-		} catch(\Exception $e) {
246
+		} catch (\Exception $e) {
247 247
 			\OC::$server->getLogger()->logException($e, [
248 248
 				'message' => __METHOD__,
249 249
 				'level' => ILogger::ERROR,
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	public function getIdsForTag($tag) {
268 268
 		$result = null;
269 269
 		$tagId = false;
270
-		if(is_numeric($tag)) {
270
+		if (is_numeric($tag)) {
271 271
 			$tagId = $tag;
272
-		} elseif(is_string($tag)) {
272
+		} elseif (is_string($tag)) {
273 273
 			$tag = trim($tag);
274
-			if($tag === '') {
274
+			if ($tag === '') {
275 275
 				\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG);
276 276
 				return false;
277 277
 			}
278 278
 			$tagId = $this->getTagId($tag);
279 279
 		}
280 280
 
281
-		if($tagId === false) {
281
+		if ($tagId === false) {
282 282
 			$l10n = \OC::$server->getL10N('core');
283 283
 			throw new \Exception(
284 284
 				$l10n->t('Could not find category "%s"', [$tag])
@@ -286,17 +286,17 @@  discard block
 block discarded – undo
286 286
 		}
287 287
 
288 288
 		$ids = [];
289
-		$sql = 'SELECT `objid` FROM `' . self::RELATION_TABLE
289
+		$sql = 'SELECT `objid` FROM `'.self::RELATION_TABLE
290 290
 			. '` WHERE `categoryid` = ?';
291 291
 
292 292
 		try {
293 293
 			$stmt = \OC_DB::prepare($sql);
294 294
 			$result = $stmt->execute([$tagId]);
295 295
 			if ($result === null) {
296
-				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
296
+				\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
297 297
 				return false;
298 298
 			}
299
-		} catch(\Exception $e) {
299
+		} catch (\Exception $e) {
300 300
 			\OC::$server->getLogger()->logException($e, [
301 301
 				'message' => __METHOD__,
302 302
 				'level' => ILogger::ERROR,
@@ -305,9 +305,9 @@  discard block
 block discarded – undo
305 305
 			return false;
306 306
 		}
307 307
 
308
-		if(!is_null($result)) {
309
-			while( $row = $result->fetchRow()) {
310
-				$id = (int)$row['objid'];
308
+		if (!is_null($result)) {
309
+			while ($row = $result->fetchRow()) {
310
+				$id = (int) $row['objid'];
311 311
 
312 312
 				if ($this->includeShared) {
313 313
 					// We have to check if we are really allowed to access the
@@ -361,19 +361,19 @@  discard block
 block discarded – undo
361 361
 	public function add($name) {
362 362
 		$name = trim($name);
363 363
 
364
-		if($name === '') {
364
+		if ($name === '') {
365 365
 			\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
366 366
 			return false;
367 367
 		}
368
-		if($this->userHasTag($name, $this->user)) {
369
-			\OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', ILogger::DEBUG);
368
+		if ($this->userHasTag($name, $this->user)) {
369
+			\OCP\Util::writeLog('core', __METHOD__.', name: '.$name.' exists already', ILogger::DEBUG);
370 370
 			return false;
371 371
 		}
372 372
 		try {
373 373
 			$tag = new Tag($this->user, $this->type, $name);
374 374
 			$tag = $this->mapper->insert($tag);
375 375
 			$this->tags[] = $tag;
376
-		} catch(\Exception $e) {
376
+		} catch (\Exception $e) {
377 377
 			\OC::$server->getLogger()->logException($e, [
378 378
 				'message' => __METHOD__,
379 379
 				'level' => ILogger::ERROR,
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 			]);
382 382
 			return false;
383 383
 		}
384
-		\OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), ILogger::DEBUG);
384
+		\OCP\Util::writeLog('core', __METHOD__.', id: '.$tag->getId(), ILogger::DEBUG);
385 385
 		return $tag->getId();
386 386
 	}
387 387
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 		$from = trim($from);
397 397
 		$to = trim($to);
398 398
 
399
-		if($to === '' || $from === '') {
399
+		if ($to === '' || $from === '') {
400 400
 			\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG);
401 401
 			return false;
402 402
 		}
@@ -406,21 +406,21 @@  discard block
 block discarded – undo
406 406
 		} else {
407 407
 			$key = $this->getTagByName($from);
408 408
 		}
409
-		if($key === false) {
410
-			\OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', ILogger::DEBUG);
409
+		if ($key === false) {
410
+			\OCP\Util::writeLog('core', __METHOD__.', tag: '.$from.' does not exist', ILogger::DEBUG);
411 411
 			return false;
412 412
 		}
413 413
 		$tag = $this->tags[$key];
414 414
 
415
-		if($this->userHasTag($to, $tag->getOwner())) {
416
-			\OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', ILogger::DEBUG);
415
+		if ($this->userHasTag($to, $tag->getOwner())) {
416
+			\OCP\Util::writeLog('core', __METHOD__.', A tag named '.$to.' already exists for user '.$tag->getOwner().'.', ILogger::DEBUG);
417 417
 			return false;
418 418
 		}
419 419
 
420 420
 		try {
421 421
 			$tag->setName($to);
422 422
 			$this->tags[$key] = $this->mapper->update($tag);
423
-		} catch(\Exception $e) {
423
+		} catch (\Exception $e) {
424 424
 			\OC::$server->getLogger()->logException($e, [
425 425
 				'message' => __METHOD__,
426 426
 				'level' => ILogger::ERROR,
@@ -440,25 +440,25 @@  discard block
 block discarded – undo
440 440
 	 * @param int|null $id int Optional object id to add to this|these tag(s)
441 441
 	 * @return bool Returns false on error.
442 442
 	 */
443
-	public function addMultiple($names, $sync=false, $id = null) {
444
-		if(!is_array($names)) {
443
+	public function addMultiple($names, $sync = false, $id = null) {
444
+		if (!is_array($names)) {
445 445
 			$names = [$names];
446 446
 		}
447 447
 		$names = array_map('trim', $names);
448 448
 		array_filter($names);
449 449
 
450 450
 		$newones = [];
451
-		foreach($names as $name) {
452
-			if(!$this->hasTag($name) && $name !== '') {
451
+		foreach ($names as $name) {
452
+			if (!$this->hasTag($name) && $name !== '') {
453 453
 				$newones[] = new Tag($this->user, $this->type, $name);
454 454
 			}
455
-			if(!is_null($id) ) {
455
+			if (!is_null($id)) {
456 456
 				// Insert $objectid, $categoryid  pairs if not exist.
457 457
 				self::$relations[] = ['objid' => $id, 'tag' => $name];
458 458
 			}
459 459
 		}
460 460
 		$this->tags = array_merge($this->tags, $newones);
461
-		if($sync === true) {
461
+		if ($sync === true) {
462 462
 			$this->save();
463 463
 		}
464 464
 
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 	 * Save the list of tags and their object relations
470 470
 	 */
471 471
 	protected function save() {
472
-		if(is_array($this->tags)) {
473
-			foreach($this->tags as $tag) {
472
+		if (is_array($this->tags)) {
473
+			foreach ($this->tags as $tag) {
474 474
 				try {
475 475
 					if (!$this->mapper->tagExists($tag)) {
476 476
 						$this->mapper->insert($tag);
477 477
 					}
478
-				} catch(\Exception $e) {
478
+				} catch (\Exception $e) {
479 479
 					\OC::$server->getLogger()->logException($e, [
480 480
 						'message' => __METHOD__,
481 481
 						'level' => ILogger::ERROR,
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
 			// reload tags to get the proper ids.
488 488
 			$this->tags = $this->mapper->loadTags($this->owners, $this->type);
489
-			\OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true),
489
+			\OCP\Util::writeLog('core', __METHOD__.', tags: '.print_r($this->tags, true),
490 490
 				ILogger::DEBUG);
491 491
 			// Loop through temporarily cached objectid/tagname pairs
492 492
 			// and save relations.
@@ -494,10 +494,10 @@  discard block
 block discarded – undo
494 494
 			// For some reason this is needed or array_search(i) will return 0..?
495 495
 			ksort($tags);
496 496
 			$dbConnection = \OC::$server->getDatabaseConnection();
497
-			foreach(self::$relations as $relation) {
497
+			foreach (self::$relations as $relation) {
498 498
 				$tagId = $this->getTagId($relation['tag']);
499
-				\OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, ILogger::DEBUG);
500
-				if($tagId) {
499
+				\OCP\Util::writeLog('core', __METHOD__.'catid, '.$relation['tag'].' '.$tagId, ILogger::DEBUG);
500
+				if ($tagId) {
501 501
 					try {
502 502
 						$dbConnection->insertIfNotExist(self::RELATION_TABLE,
503 503
 							[
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 								'categoryid' => $tagId,
506 506
 								'type' => $this->type,
507 507
 								]);
508
-					} catch(\Exception $e) {
508
+					} catch (\Exception $e) {
509 509
 						\OC::$server->getLogger()->logException($e, [
510 510
 							'message' => __METHOD__,
511 511
 							'level' => ILogger::ERROR,
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
 		// Find all objectid/tagId pairs.
533 533
 		$result = null;
534 534
 		try {
535
-			$stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
535
+			$stmt = \OC_DB::prepare('SELECT `id` FROM `'.self::TAG_TABLE.'` '
536 536
 				. 'WHERE `uid` = ?');
537 537
 			$result = $stmt->execute([$arguments['uid']]);
538 538
 			if ($result === null) {
539
-				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
539
+				\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
540 540
 			}
541
-		} catch(\Exception $e) {
541
+		} catch (\Exception $e) {
542 542
 			\OC::$server->getLogger()->logException($e, [
543 543
 				'message' => __METHOD__,
544 544
 				'level' => ILogger::ERROR,
@@ -546,14 +546,14 @@  discard block
 block discarded – undo
546 546
 			]);
547 547
 		}
548 548
 
549
-		if(!is_null($result)) {
549
+		if (!is_null($result)) {
550 550
 			try {
551
-				$stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
551
+				$stmt = \OC_DB::prepare('DELETE FROM `'.self::RELATION_TABLE.'` '
552 552
 					. 'WHERE `categoryid` = ?');
553
-				while( $row = $result->fetchRow()) {
553
+				while ($row = $result->fetchRow()) {
554 554
 					try {
555 555
 						$stmt->execute([$row['id']]);
556
-					} catch(\Exception $e) {
556
+					} catch (\Exception $e) {
557 557
 						\OC::$server->getLogger()->logException($e, [
558 558
 							'message' => __METHOD__,
559 559
 							'level' => ILogger::ERROR,
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 						]);
562 562
 					}
563 563
 				}
564
-			} catch(\Exception $e) {
564
+			} catch (\Exception $e) {
565 565
 				\OC::$server->getLogger()->logException($e, [
566 566
 					'message' => __METHOD__,
567 567
 					'level' => ILogger::ERROR,
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 			}
571 571
 		}
572 572
 		try {
573
-			$stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
573
+			$stmt = \OC_DB::prepare('DELETE FROM `'.self::TAG_TABLE.'` '
574 574
 				. 'WHERE `uid` = ?');
575 575
 			$result = $stmt->execute([$arguments['uid']]);
576 576
 			if ($result === null) {
577
-				\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
577
+				\OCP\Util::writeLog('core', __METHOD__.', DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
578 578
 			}
579
-		} catch(\Exception $e) {
579
+		} catch (\Exception $e) {
580 580
 			\OC::$server->getLogger()->logException($e, [
581 581
 				'message' => __METHOD__,
582 582
 				'level' => ILogger::ERROR,
@@ -592,23 +592,23 @@  discard block
 block discarded – undo
592 592
 	 * @return boolean Returns false on error.
593 593
 	 */
594 594
 	public function purgeObjects(array $ids) {
595
-		if(count($ids) === 0) {
595
+		if (count($ids) === 0) {
596 596
 			// job done ;)
597 597
 			return true;
598 598
 		}
599 599
 		$updates = $ids;
600 600
 		try {
601
-			$query = 'DELETE FROM `' . self::RELATION_TABLE . '` ';
602
-			$query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) ';
601
+			$query = 'DELETE FROM `'.self::RELATION_TABLE.'` ';
602
+			$query .= 'WHERE `objid` IN ('.str_repeat('?,', count($ids) - 1).'?) ';
603 603
 			$query .= 'AND `type`= ?';
604 604
 			$updates[] = $this->type;
605 605
 			$stmt = \OC_DB::prepare($query);
606 606
 			$result = $stmt->execute($updates);
607 607
 			if ($result === null) {
608
-				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
608
+				\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
609 609
 				return false;
610 610
 			}
611
-		} catch(\Exception $e) {
611
+		} catch (\Exception $e) {
612 612
 			\OC::$server->getLogger()->logException($e, [
613 613
 				'message' => __METHOD__,
614 614
 				'level' => ILogger::ERROR,
@@ -625,13 +625,13 @@  discard block
 block discarded – undo
625 625
 	 * @return array|false An array of object ids.
626 626
 	 */
627 627
 	public function getFavorites() {
628
-		if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
628
+		if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
629 629
 			return [];
630 630
 		}
631 631
 
632 632
 		try {
633 633
 			return $this->getIdsForTag(ITags::TAG_FAVORITE);
634
-		} catch(\Exception $e) {
634
+		} catch (\Exception $e) {
635 635
 			\OC::$server->getLogger()->logException($e, [
636 636
 				'message' => __METHOD__,
637 637
 				'level' => ILogger::ERROR,
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 * @return boolean
649 649
 	 */
650 650
 	public function addToFavorites($objid) {
651
-		if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
651
+		if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
652 652
 			$this->add(ITags::TAG_FAVORITE);
653 653
 		}
654 654
 		return $this->tagAs($objid, ITags::TAG_FAVORITE);
@@ -672,16 +672,16 @@  discard block
 block discarded – undo
672 672
 	 * @return boolean Returns false on error.
673 673
 	 */
674 674
 	public function tagAs($objid, $tag) {
675
-		if(is_string($tag) && !is_numeric($tag)) {
675
+		if (is_string($tag) && !is_numeric($tag)) {
676 676
 			$tag = trim($tag);
677
-			if($tag === '') {
677
+			if ($tag === '') {
678 678
 				\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
679 679
 				return false;
680 680
 			}
681
-			if(!$this->hasTag($tag)) {
681
+			if (!$this->hasTag($tag)) {
682 682
 				$this->add($tag);
683 683
 			}
684
-			$tagId =  $this->getTagId($tag);
684
+			$tagId = $this->getTagId($tag);
685 685
 		} else {
686 686
 			$tagId = $tag;
687 687
 		}
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 					'categoryid' => $tagId,
693 693
 					'type' => $this->type,
694 694
 				]);
695
-		} catch(\Exception $e) {
695
+		} catch (\Exception $e) {
696 696
 			\OC::$server->getLogger()->logException($e, [
697 697
 				'message' => __METHOD__,
698 698
 				'level' => ILogger::ERROR,
@@ -711,23 +711,23 @@  discard block
 block discarded – undo
711 711
 	 * @return boolean
712 712
 	 */
713 713
 	public function unTag($objid, $tag) {
714
-		if(is_string($tag) && !is_numeric($tag)) {
714
+		if (is_string($tag) && !is_numeric($tag)) {
715 715
 			$tag = trim($tag);
716
-			if($tag === '') {
716
+			if ($tag === '') {
717 717
 				\OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG);
718 718
 				return false;
719 719
 			}
720
-			$tagId =  $this->getTagId($tag);
720
+			$tagId = $this->getTagId($tag);
721 721
 		} else {
722 722
 			$tagId = $tag;
723 723
 		}
724 724
 
725 725
 		try {
726
-			$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
726
+			$sql = 'DELETE FROM `'.self::RELATION_TABLE.'` '
727 727
 					. 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?';
728 728
 			$stmt = \OC_DB::prepare($sql);
729 729
 			$stmt->execute([$objid, $tagId, $this->type]);
730
-		} catch(\Exception $e) {
730
+		} catch (\Exception $e) {
731 731
 			\OC::$server->getLogger()->logException($e, [
732 732
 				'message' => __METHOD__,
733 733
 				'level' => ILogger::ERROR,
@@ -745,16 +745,16 @@  discard block
 block discarded – undo
745 745
 	 * @return bool Returns false on error
746 746
 	 */
747 747
 	public function delete($names) {
748
-		if(!is_array($names)) {
748
+		if (!is_array($names)) {
749 749
 			$names = [$names];
750 750
 		}
751 751
 
752 752
 		$names = array_map('trim', $names);
753 753
 		array_filter($names);
754 754
 
755
-		\OCP\Util::writeLog('core', __METHOD__ . ', before: '
755
+		\OCP\Util::writeLog('core', __METHOD__.', before: '
756 756
 			. print_r($this->tags, true), ILogger::DEBUG);
757
-		foreach($names as $name) {
757
+		foreach ($names as $name) {
758 758
 			$id = null;
759 759
 
760 760
 			if (is_numeric($name)) {
@@ -768,22 +768,22 @@  discard block
 block discarded – undo
768 768
 				unset($this->tags[$key]);
769 769
 				$this->mapper->delete($tag);
770 770
 			} else {
771
-				\OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name
771
+				\OCP\Util::writeLog('core', __METHOD__.'Cannot delete tag '.$name
772 772
 					. ': not found.', ILogger::ERROR);
773 773
 			}
774
-			if(!is_null($id) && $id !== false) {
774
+			if (!is_null($id) && $id !== false) {
775 775
 				try {
776
-					$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
776
+					$sql = 'DELETE FROM `'.self::RELATION_TABLE.'` '
777 777
 							. 'WHERE `categoryid` = ?';
778 778
 					$stmt = \OC_DB::prepare($sql);
779 779
 					$result = $stmt->execute([$id]);
780 780
 					if ($result === null) {
781 781
 						\OCP\Util::writeLog('core',
782
-							__METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(),
782
+							__METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(),
783 783
 							ILogger::ERROR);
784 784
 						return false;
785 785
 					}
786
-				} catch(\Exception $e) {
786
+				} catch (\Exception $e) {
787 787
 					\OC::$server->getLogger()->logException($e, [
788 788
 						'message' => __METHOD__,
789 789
 						'level' => ILogger::ERROR,
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
 	}
798 798
 
799 799
 	// case-insensitive array_search
800
-	protected function array_searchi($needle, $haystack, $mem='getName') {
801
-		if(!is_array($haystack)) {
800
+	protected function array_searchi($needle, $haystack, $mem = 'getName') {
801
+		if (!is_array($haystack)) {
802 802
 			return false;
803 803
 		}
804 804
 		return array_search(strtolower($needle), array_map(
Please login to merge, or discard this patch.
core/Command/Background/Base.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 	 */
72 72
 	protected function execute(InputInterface $input, OutputInterface $output) {
73 73
 		$mode = $this->getMode();
74
-		$this->config->setAppValue( 'core', 'backgroundjobs_mode', $mode );
74
+		$this->config->setAppValue('core', 'backgroundjobs_mode', $mode);
75 75
 		$output->writeln("Set mode for background jobs to '$mode'");
76 76
 	}
77 77
 }
Please login to merge, or discard this patch.
core/Controller/WebAuthnController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 			'preLoginNameUsedAsUserName',
78 78
 			['uid' => &$uid]
79 79
 		);
80
-		$this->logger->debug('Got UID: ' . $uid);
80
+		$this->logger->debug('Got UID: '.$uid);
81 81
 
82 82
 		$publicKeyCredentialRequestOptions = $this->webAuthnManger->startAuthentication($uid, $this->request->getServerHost());
83 83
 		$this->session->set(self::WEBAUTHN_LOGIN, json_encode($publicKeyCredentialRequestOptions));
Please login to merge, or discard this patch.