Passed
Push — master ( 62403d...0c3e2f )
by Joas
14:50 queued 14s
created
lib/private/Tags.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		}
135 135
 		$this->tags = $this->mapper->loadTags($this->owners, $this->type);
136 136
 
137
-		if(count($defaultTags) > 0 && count($this->tags) === 0) {
137
+		if (count($defaultTags) > 0 && count($this->tags) === 0) {
138 138
 			$this->addMultiple($defaultTags, true);
139 139
 		}
140 140
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	* @return array
176 176
 	*/
177 177
 	public function getTags() {
178
-		if(!count($this->tags)) {
178
+		if (!count($this->tags)) {
179 179
 			return [];
180 180
 		}
181 181
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 		});
185 185
 		$tagMap = [];
186 186
 
187
-		foreach($this->tags as $tag) {
188
-			if($tag->getName() !== ITags::TAG_FAVORITE) {
187
+		foreach ($this->tags as $tag) {
188
+			if ($tag->getName() !== ITags::TAG_FAVORITE) {
189 189
 				$tagMap[] = $this->tagMap($tag);
190 190
 			}
191 191
 		}
@@ -223,25 +223,25 @@  discard block
 block discarded – undo
223 223
 			$chunks = array_chunk($objIds, 900, false);
224 224
 			foreach ($chunks as $chunk) {
225 225
 				$result = $conn->executeQuery(
226
-					'SELECT `category`, `categoryid`, `objid` ' .
227
-					'FROM `' . self::RELATION_TABLE . '` r, `' . self::TAG_TABLE . '` ' .
226
+					'SELECT `category`, `categoryid`, `objid` '.
227
+					'FROM `'.self::RELATION_TABLE.'` r, `'.self::TAG_TABLE.'` '.
228 228
 					'WHERE `categoryid` = `id` AND `uid` = ? AND r.`type` = ? AND `objid` IN (?)',
229 229
 					[$this->user, $this->type, $chunk],
230 230
 					[null, null, IQueryBuilder::PARAM_INT_ARRAY]
231 231
 				);
232 232
 				while ($row = $result->fetch()) {
233
-					$objId = (int)$row['objid'];
233
+					$objId = (int) $row['objid'];
234 234
 					if (!isset($entries[$objId])) {
235 235
 						$entries[$objId] = [];
236 236
 					}
237 237
 					$entries[$objId][] = $row['category'];
238 238
 				}
239 239
 				if ($result === null) {
240
-					\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
240
+					\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
241 241
 					return false;
242 242
 				}
243 243
 			}
244
-		} catch(\Exception $e) {
244
+		} catch (\Exception $e) {
245 245
 			\OC::$server->getLogger()->logException($e, [
246 246
 				'message' => __METHOD__,
247 247
 				'level' => ILogger::ERROR,
@@ -265,18 +265,18 @@  discard block
 block discarded – undo
265 265
 	public function getIdsForTag($tag) {
266 266
 		$result = null;
267 267
 		$tagId = false;
268
-		if(is_numeric($tag)) {
268
+		if (is_numeric($tag)) {
269 269
 			$tagId = $tag;
270
-		} elseif(is_string($tag)) {
270
+		} elseif (is_string($tag)) {
271 271
 			$tag = trim($tag);
272
-			if($tag === '') {
272
+			if ($tag === '') {
273 273
 				\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG);
274 274
 				return false;
275 275
 			}
276 276
 			$tagId = $this->getTagId($tag);
277 277
 		}
278 278
 
279
-		if($tagId === false) {
279
+		if ($tagId === false) {
280 280
 			$l10n = \OC::$server->getL10N('core');
281 281
 			throw new \Exception(
282 282
 				$l10n->t('Could not find category "%s"', [$tag])
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
 		}
285 285
 
286 286
 		$ids = [];
287
-		$sql = 'SELECT `objid` FROM `' . self::RELATION_TABLE
287
+		$sql = 'SELECT `objid` FROM `'.self::RELATION_TABLE
288 288
 			. '` WHERE `categoryid` = ?';
289 289
 
290 290
 		try {
291 291
 			$stmt = \OC_DB::prepare($sql);
292 292
 			$result = $stmt->execute([$tagId]);
293 293
 			if ($result === null) {
294
-				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
294
+				\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
295 295
 				return false;
296 296
 			}
297
-		} catch(\Exception $e) {
297
+		} catch (\Exception $e) {
298 298
 			\OC::$server->getLogger()->logException($e, [
299 299
 				'message' => __METHOD__,
300 300
 				'level' => ILogger::ERROR,
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 			return false;
304 304
 		}
305 305
 
306
-		if(!is_null($result)) {
307
-			while( $row = $result->fetchRow()) {
308
-				$id = (int)$row['objid'];
306
+		if (!is_null($result)) {
307
+			while ($row = $result->fetchRow()) {
308
+				$id = (int) $row['objid'];
309 309
 
310 310
 				if ($this->includeShared) {
311 311
 					// We have to check if we are really allowed to access the
@@ -359,19 +359,19 @@  discard block
 block discarded – undo
359 359
 	public function add($name) {
360 360
 		$name = trim($name);
361 361
 
362
-		if($name === '') {
362
+		if ($name === '') {
363 363
 			\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
364 364
 			return false;
365 365
 		}
366
-		if($this->userHasTag($name, $this->user)) {
367
-			\OCP\Util::writeLog('core', __METHOD__.', name: ' . $name. ' exists already', ILogger::DEBUG);
366
+		if ($this->userHasTag($name, $this->user)) {
367
+			\OCP\Util::writeLog('core', __METHOD__.', name: '.$name.' exists already', ILogger::DEBUG);
368 368
 			return false;
369 369
 		}
370 370
 		try {
371 371
 			$tag = new Tag($this->user, $this->type, $name);
372 372
 			$tag = $this->mapper->insert($tag);
373 373
 			$this->tags[] = $tag;
374
-		} catch(\Exception $e) {
374
+		} catch (\Exception $e) {
375 375
 			\OC::$server->getLogger()->logException($e, [
376 376
 				'message' => __METHOD__,
377 377
 				'level' => ILogger::ERROR,
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 			]);
380 380
 			return false;
381 381
 		}
382
-		\OCP\Util::writeLog('core', __METHOD__.', id: ' . $tag->getId(), ILogger::DEBUG);
382
+		\OCP\Util::writeLog('core', __METHOD__.', id: '.$tag->getId(), ILogger::DEBUG);
383 383
 		return $tag->getId();
384 384
 	}
385 385
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		$from = trim($from);
395 395
 		$to = trim($to);
396 396
 
397
-		if($to === '' || $from === '') {
397
+		if ($to === '' || $from === '') {
398 398
 			\OCP\Util::writeLog('core', __METHOD__.', Cannot use empty tag names', ILogger::DEBUG);
399 399
 			return false;
400 400
 		}
@@ -404,21 +404,21 @@  discard block
 block discarded – undo
404 404
 		} else {
405 405
 			$key = $this->getTagByName($from);
406 406
 		}
407
-		if($key === false) {
408
-			\OCP\Util::writeLog('core', __METHOD__.', tag: ' . $from. ' does not exist', ILogger::DEBUG);
407
+		if ($key === false) {
408
+			\OCP\Util::writeLog('core', __METHOD__.', tag: '.$from.' does not exist', ILogger::DEBUG);
409 409
 			return false;
410 410
 		}
411 411
 		$tag = $this->tags[$key];
412 412
 
413
-		if($this->userHasTag($to, $tag->getOwner())) {
414
-			\OCP\Util::writeLog('core', __METHOD__.', A tag named ' . $to. ' already exists for user ' . $tag->getOwner() . '.', ILogger::DEBUG);
413
+		if ($this->userHasTag($to, $tag->getOwner())) {
414
+			\OCP\Util::writeLog('core', __METHOD__.', A tag named '.$to.' already exists for user '.$tag->getOwner().'.', ILogger::DEBUG);
415 415
 			return false;
416 416
 		}
417 417
 
418 418
 		try {
419 419
 			$tag->setName($to);
420 420
 			$this->tags[$key] = $this->mapper->update($tag);
421
-		} catch(\Exception $e) {
421
+		} catch (\Exception $e) {
422 422
 			\OC::$server->getLogger()->logException($e, [
423 423
 				'message' => __METHOD__,
424 424
 				'level' => ILogger::ERROR,
@@ -438,25 +438,25 @@  discard block
 block discarded – undo
438 438
 	* @param int|null $id int Optional object id to add to this|these tag(s)
439 439
 	* @return bool Returns false on error.
440 440
 	*/
441
-	public function addMultiple($names, $sync=false, $id = null) {
442
-		if(!is_array($names)) {
441
+	public function addMultiple($names, $sync = false, $id = null) {
442
+		if (!is_array($names)) {
443 443
 			$names = [$names];
444 444
 		}
445 445
 		$names = array_map('trim', $names);
446 446
 		array_filter($names);
447 447
 
448 448
 		$newones = [];
449
-		foreach($names as $name) {
450
-			if(!$this->hasTag($name) && $name !== '') {
449
+		foreach ($names as $name) {
450
+			if (!$this->hasTag($name) && $name !== '') {
451 451
 				$newones[] = new Tag($this->user, $this->type, $name);
452 452
 			}
453
-			if(!is_null($id) ) {
453
+			if (!is_null($id)) {
454 454
 				// Insert $objectid, $categoryid  pairs if not exist.
455 455
 				self::$relations[] = ['objid' => $id, 'tag' => $name];
456 456
 			}
457 457
 		}
458 458
 		$this->tags = array_merge($this->tags, $newones);
459
-		if($sync === true) {
459
+		if ($sync === true) {
460 460
 			$this->save();
461 461
 		}
462 462
 
@@ -467,13 +467,13 @@  discard block
 block discarded – undo
467 467
 	 * Save the list of tags and their object relations
468 468
 	 */
469 469
 	protected function save() {
470
-		if(is_array($this->tags)) {
471
-			foreach($this->tags as $tag) {
470
+		if (is_array($this->tags)) {
471
+			foreach ($this->tags as $tag) {
472 472
 				try {
473 473
 					if (!$this->mapper->tagExists($tag)) {
474 474
 						$this->mapper->insert($tag);
475 475
 					}
476
-				} catch(\Exception $e) {
476
+				} catch (\Exception $e) {
477 477
 					\OC::$server->getLogger()->logException($e, [
478 478
 						'message' => __METHOD__,
479 479
 						'level' => ILogger::ERROR,
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 
485 485
 			// reload tags to get the proper ids.
486 486
 			$this->tags = $this->mapper->loadTags($this->owners, $this->type);
487
-			\OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true),
487
+			\OCP\Util::writeLog('core', __METHOD__.', tags: '.print_r($this->tags, true),
488 488
 				ILogger::DEBUG);
489 489
 			// Loop through temporarily cached objectid/tagname pairs
490 490
 			// and save relations.
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
 			// For some reason this is needed or array_search(i) will return 0..?
493 493
 			ksort($tags);
494 494
 			$dbConnection = \OC::$server->getDatabaseConnection();
495
-			foreach(self::$relations as $relation) {
495
+			foreach (self::$relations as $relation) {
496 496
 				$tagId = $this->getTagId($relation['tag']);
497
-				\OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, ILogger::DEBUG);
498
-				if($tagId) {
497
+				\OCP\Util::writeLog('core', __METHOD__.'catid, '.$relation['tag'].' '.$tagId, ILogger::DEBUG);
498
+				if ($tagId) {
499 499
 					try {
500 500
 						$dbConnection->insertIfNotExist(self::RELATION_TABLE,
501 501
 							[
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 								'categoryid' => $tagId,
504 504
 								'type' => $this->type,
505 505
 								]);
506
-					} catch(\Exception $e) {
506
+					} catch (\Exception $e) {
507 507
 						\OC::$server->getLogger()->logException($e, [
508 508
 							'message' => __METHOD__,
509 509
 							'level' => ILogger::ERROR,
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 		// Find all objectid/tagId pairs.
531 531
 		$result = null;
532 532
 		try {
533
-			$stmt = \OC_DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
533
+			$stmt = \OC_DB::prepare('SELECT `id` FROM `'.self::TAG_TABLE.'` '
534 534
 				. 'WHERE `uid` = ?');
535 535
 			$result = $stmt->execute([$arguments['uid']]);
536 536
 			if ($result === null) {
537
-				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
537
+				\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
538 538
 			}
539
-		} catch(\Exception $e) {
539
+		} catch (\Exception $e) {
540 540
 			\OC::$server->getLogger()->logException($e, [
541 541
 				'message' => __METHOD__,
542 542
 				'level' => ILogger::ERROR,
@@ -544,14 +544,14 @@  discard block
 block discarded – undo
544 544
 			]);
545 545
 		}
546 546
 
547
-		if(!is_null($result)) {
547
+		if (!is_null($result)) {
548 548
 			try {
549
-				$stmt = \OC_DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
549
+				$stmt = \OC_DB::prepare('DELETE FROM `'.self::RELATION_TABLE.'` '
550 550
 					. 'WHERE `categoryid` = ?');
551
-				while( $row = $result->fetchRow()) {
551
+				while ($row = $result->fetchRow()) {
552 552
 					try {
553 553
 						$stmt->execute([$row['id']]);
554
-					} catch(\Exception $e) {
554
+					} catch (\Exception $e) {
555 555
 						\OC::$server->getLogger()->logException($e, [
556 556
 							'message' => __METHOD__,
557 557
 							'level' => ILogger::ERROR,
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 						]);
560 560
 					}
561 561
 				}
562
-			} catch(\Exception $e) {
562
+			} catch (\Exception $e) {
563 563
 				\OC::$server->getLogger()->logException($e, [
564 564
 					'message' => __METHOD__,
565 565
 					'level' => ILogger::ERROR,
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
 			}
569 569
 		}
570 570
 		try {
571
-			$stmt = \OC_DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
571
+			$stmt = \OC_DB::prepare('DELETE FROM `'.self::TAG_TABLE.'` '
572 572
 				. 'WHERE `uid` = ?');
573 573
 			$result = $stmt->execute([$arguments['uid']]);
574 574
 			if ($result === null) {
575
-				\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
575
+				\OCP\Util::writeLog('core', __METHOD__.', DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
576 576
 			}
577
-		} catch(\Exception $e) {
577
+		} catch (\Exception $e) {
578 578
 			\OC::$server->getLogger()->logException($e, [
579 579
 				'message' => __METHOD__,
580 580
 				'level' => ILogger::ERROR,
@@ -590,23 +590,23 @@  discard block
 block discarded – undo
590 590
 	* @return boolean Returns false on error.
591 591
 	*/
592 592
 	public function purgeObjects(array $ids) {
593
-		if(count($ids) === 0) {
593
+		if (count($ids) === 0) {
594 594
 			// job done ;)
595 595
 			return true;
596 596
 		}
597 597
 		$updates = $ids;
598 598
 		try {
599
-			$query = 'DELETE FROM `' . self::RELATION_TABLE . '` ';
600
-			$query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) ';
599
+			$query = 'DELETE FROM `'.self::RELATION_TABLE.'` ';
600
+			$query .= 'WHERE `objid` IN ('.str_repeat('?,', count($ids) - 1).'?) ';
601 601
 			$query .= 'AND `type`= ?';
602 602
 			$updates[] = $this->type;
603 603
 			$stmt = \OC_DB::prepare($query);
604 604
 			$result = $stmt->execute($updates);
605 605
 			if ($result === null) {
606
-				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
606
+				\OCP\Util::writeLog('core', __METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(), ILogger::ERROR);
607 607
 				return false;
608 608
 			}
609
-		} catch(\Exception $e) {
609
+		} catch (\Exception $e) {
610 610
 			\OC::$server->getLogger()->logException($e, [
611 611
 				'message' => __METHOD__,
612 612
 				'level' => ILogger::ERROR,
@@ -623,13 +623,13 @@  discard block
 block discarded – undo
623 623
 	* @return array|false An array of object ids.
624 624
 	*/
625 625
 	public function getFavorites() {
626
-		if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
626
+		if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
627 627
 			return [];
628 628
 		}
629 629
 
630 630
 		try {
631 631
 			return $this->getIdsForTag(ITags::TAG_FAVORITE);
632
-		} catch(\Exception $e) {
632
+		} catch (\Exception $e) {
633 633
 			\OC::$server->getLogger()->logException($e, [
634 634
 				'message' => __METHOD__,
635 635
 				'level' => ILogger::ERROR,
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	* @return boolean
647 647
 	*/
648 648
 	public function addToFavorites($objid) {
649
-		if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
649
+		if (!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
650 650
 			$this->add(ITags::TAG_FAVORITE);
651 651
 		}
652 652
 		return $this->tagAs($objid, ITags::TAG_FAVORITE);
@@ -670,16 +670,16 @@  discard block
 block discarded – undo
670 670
 	* @return boolean Returns false on error.
671 671
 	*/
672 672
 	public function tagAs($objid, $tag) {
673
-		if(is_string($tag) && !is_numeric($tag)) {
673
+		if (is_string($tag) && !is_numeric($tag)) {
674 674
 			$tag = trim($tag);
675
-			if($tag === '') {
675
+			if ($tag === '') {
676 676
 				\OCP\Util::writeLog('core', __METHOD__.', Cannot add an empty tag', ILogger::DEBUG);
677 677
 				return false;
678 678
 			}
679
-			if(!$this->hasTag($tag)) {
679
+			if (!$this->hasTag($tag)) {
680 680
 				$this->add($tag);
681 681
 			}
682
-			$tagId =  $this->getTagId($tag);
682
+			$tagId = $this->getTagId($tag);
683 683
 		} else {
684 684
 			$tagId = $tag;
685 685
 		}
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 					'categoryid' => $tagId,
691 691
 					'type' => $this->type,
692 692
 				]);
693
-		} catch(\Exception $e) {
693
+		} catch (\Exception $e) {
694 694
 			\OC::$server->getLogger()->logException($e, [
695 695
 				'message' => __METHOD__,
696 696
 				'level' => ILogger::ERROR,
@@ -709,23 +709,23 @@  discard block
 block discarded – undo
709 709
 	* @return boolean
710 710
 	*/
711 711
 	public function unTag($objid, $tag) {
712
-		if(is_string($tag) && !is_numeric($tag)) {
712
+		if (is_string($tag) && !is_numeric($tag)) {
713 713
 			$tag = trim($tag);
714
-			if($tag === '') {
714
+			if ($tag === '') {
715 715
 				\OCP\Util::writeLog('core', __METHOD__.', Tag name is empty', ILogger::DEBUG);
716 716
 				return false;
717 717
 			}
718
-			$tagId =  $this->getTagId($tag);
718
+			$tagId = $this->getTagId($tag);
719 719
 		} else {
720 720
 			$tagId = $tag;
721 721
 		}
722 722
 
723 723
 		try {
724
-			$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
724
+			$sql = 'DELETE FROM `'.self::RELATION_TABLE.'` '
725 725
 					. 'WHERE `objid` = ? AND `categoryid` = ? AND `type` = ?';
726 726
 			$stmt = \OC_DB::prepare($sql);
727 727
 			$stmt->execute([$objid, $tagId, $this->type]);
728
-		} catch(\Exception $e) {
728
+		} catch (\Exception $e) {
729 729
 			\OC::$server->getLogger()->logException($e, [
730 730
 				'message' => __METHOD__,
731 731
 				'level' => ILogger::ERROR,
@@ -743,16 +743,16 @@  discard block
 block discarded – undo
743 743
 	* @return bool Returns false on error
744 744
 	*/
745 745
 	public function delete($names) {
746
-		if(!is_array($names)) {
746
+		if (!is_array($names)) {
747 747
 			$names = [$names];
748 748
 		}
749 749
 
750 750
 		$names = array_map('trim', $names);
751 751
 		array_filter($names);
752 752
 
753
-		\OCP\Util::writeLog('core', __METHOD__ . ', before: '
753
+		\OCP\Util::writeLog('core', __METHOD__.', before: '
754 754
 			. print_r($this->tags, true), ILogger::DEBUG);
755
-		foreach($names as $name) {
755
+		foreach ($names as $name) {
756 756
 			$id = null;
757 757
 
758 758
 			if (is_numeric($name)) {
@@ -766,22 +766,22 @@  discard block
 block discarded – undo
766 766
 				unset($this->tags[$key]);
767 767
 				$this->mapper->delete($tag);
768 768
 			} else {
769
-				\OCP\Util::writeLog('core', __METHOD__ . 'Cannot delete tag ' . $name
769
+				\OCP\Util::writeLog('core', __METHOD__.'Cannot delete tag '.$name
770 770
 					. ': not found.', ILogger::ERROR);
771 771
 			}
772
-			if(!is_null($id) && $id !== false) {
772
+			if (!is_null($id) && $id !== false) {
773 773
 				try {
774
-					$sql = 'DELETE FROM `' . self::RELATION_TABLE . '` '
774
+					$sql = 'DELETE FROM `'.self::RELATION_TABLE.'` '
775 775
 							. 'WHERE `categoryid` = ?';
776 776
 					$stmt = \OC_DB::prepare($sql);
777 777
 					$result = $stmt->execute([$id]);
778 778
 					if ($result === null) {
779 779
 						\OCP\Util::writeLog('core',
780
-							__METHOD__. 'DB error: ' . \OC::$server->getDatabaseConnection()->getError(),
780
+							__METHOD__.'DB error: '.\OC::$server->getDatabaseConnection()->getError(),
781 781
 							ILogger::ERROR);
782 782
 						return false;
783 783
 					}
784
-				} catch(\Exception $e) {
784
+				} catch (\Exception $e) {
785 785
 					\OC::$server->getLogger()->logException($e, [
786 786
 						'message' => __METHOD__,
787 787
 						'level' => ILogger::ERROR,
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
 	}
796 796
 
797 797
 	// case-insensitive array_search
798
-	protected function array_searchi($needle, $haystack, $mem='getName') {
799
-		if(!is_array($haystack)) {
798
+	protected function array_searchi($needle, $haystack, $mem = 'getName') {
799
+		if (!is_array($haystack)) {
800 800
 			return false;
801 801
 		}
802 802
 		return array_search(strtolower($needle), array_map(
Please login to merge, or discard this patch.
core/ajax/update.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 // need to send an initial message to force-init the event source,
46 46
 // which will then trigger its own CSRF check and produces its own CSRF error
47 47
 // message
48
-$eventSource->send('success', (string)$l->t('Preparing update'));
48
+$eventSource->send('success', (string) $l->t('Preparing update'));
49 49
 
50 50
 class FeedBackHandler {
51 51
 	/** @var integer */
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
 				if (empty($desc)) {
82 82
 					$desc = $this->currentStep;
83 83
 				}
84
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
84
+				$this->eventSource->send('success', (string) $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc]));
85 85
 				break;
86 86
 			case '\OC\Repair::finishProgress':
87 87
 				$this->progressStateMax = $this->progressStateStep;
88
-				$this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
88
+				$this->eventSource->send('success', (string) $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep]));
89 89
 				break;
90 90
 			case '\OC\Repair::step':
91
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0));
91
+				$this->eventSource->send('success', (string) $this->l10n->t('Repair step:').' '.$event->getArgument(0));
92 92
 				break;
93 93
 			case '\OC\Repair::info':
94
-				$this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0));
94
+				$this->eventSource->send('success', (string) $this->l10n->t('Repair info:').' '.$event->getArgument(0));
95 95
 				break;
96 96
 			case '\OC\Repair::warning':
97
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0));
97
+				$this->eventSource->send('notice', (string) $this->l10n->t('Repair warning:').' '.$event->getArgument(0));
98 98
 				break;
99 99
 			case '\OC\Repair::error':
100
-				$this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0));
100
+				$this->eventSource->send('notice', (string) $this->l10n->t('Repair error:').' '.$event->getArgument(0));
101 101
 				break;
102 102
 		}
103 103
 	}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 	$config = \OC::$server->getSystemConfig();
109 109
 	if ($config->getValue('upgrade.disable-web', false)) {
110
-		$eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
110
+		$eventSource->send('failure', (string) $l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
111 111
 		$eventSource->close();
112 112
 		exit();
113 113
 	}
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	$dispatcher = \OC::$server->getEventDispatcher();
130 130
 	$dispatcher->addListener('\OC\DB\Migrator::executeSql', function($event) use ($eventSource, $l) {
131 131
 		if ($event instanceof GenericEvent) {
132
-			$eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
132
+			$eventSource->send('success', (string) $l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()]));
133 133
 		}
134 134
 	});
135 135
 	$dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($eventSource, $l) {
136 136
 		if ($event instanceof GenericEvent) {
137
-			$eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
137
+			$eventSource->send('success', (string) $l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()]));
138 138
 		}
139 139
 	});
140 140
 	$feedBack = new FeedBackHandler($eventSource, $l);
@@ -146,67 +146,67 @@  discard block
 block discarded – undo
146 146
 	$dispatcher->addListener('\OC\Repair::warning', [$feedBack, 'handleRepairFeedback']);
147 147
 	$dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']);
148 148
 
149
-	$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) {
150
-		$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
149
+	$updater->listen('\OC\Updater', 'maintenanceEnabled', function() use ($eventSource, $l) {
150
+		$eventSource->send('success', (string) $l->t('Turned on maintenance mode'));
151 151
 	});
152
-	$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) {
153
-		$eventSource->send('success', (string)$l->t('Turned off maintenance mode'));
152
+	$updater->listen('\OC\Updater', 'maintenanceDisabled', function() use ($eventSource, $l) {
153
+		$eventSource->send('success', (string) $l->t('Turned off maintenance mode'));
154 154
 	});
155
-	$updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) {
156
-		$eventSource->send('success', (string)$l->t('Maintenance mode is kept active'));
155
+	$updater->listen('\OC\Updater', 'maintenanceActive', function() use ($eventSource, $l) {
156
+		$eventSource->send('success', (string) $l->t('Maintenance mode is kept active'));
157 157
 	});
158
-	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($eventSource, $l) {
159
-		$eventSource->send('success', (string)$l->t('Updating database schema'));
158
+	$updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use($eventSource, $l) {
159
+		$eventSource->send('success', (string) $l->t('Updating database schema'));
160 160
 	});
161
-	$updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) {
162
-		$eventSource->send('success', (string)$l->t('Updated database'));
161
+	$updater->listen('\OC\Updater', 'dbUpgrade', function() use ($eventSource, $l) {
162
+		$eventSource->send('success', (string) $l->t('Updated database'));
163 163
 	});
164
-	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($eventSource, $l) {
165
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
164
+	$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($eventSource, $l) {
165
+		$eventSource->send('success', (string) $l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)'));
166 166
 	});
167
-	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) {
168
-		$eventSource->send('success', (string)$l->t('Checked database schema update'));
167
+	$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use ($eventSource, $l) {
168
+		$eventSource->send('success', (string) $l->t('Checked database schema update'));
169 169
 	});
170
-	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) {
171
-		$eventSource->send('success', (string)$l->t('Checking updates of apps'));
170
+	$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($eventSource, $l) {
171
+		$eventSource->send('success', (string) $l->t('Checking updates of apps'));
172 172
 	});
173
-	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) {
174
-		$eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app]));
173
+	$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use ($eventSource, $l) {
174
+		$eventSource->send('success', (string) $l->t('Checking for update of app "%s" in appstore', [$app]));
175 175
 	});
176
-	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) {
177
-		$eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app]));
176
+	$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use ($eventSource, $l) {
177
+		$eventSource->send('success', (string) $l->t('Update app "%s" from appstore', [$app]));
178 178
 	});
179
-	$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) {
180
-		$eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app]));
179
+	$updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use ($eventSource, $l) {
180
+		$eventSource->send('success', (string) $l->t('Checked for update of app "%s" in appstore', [$app]));
181 181
 	});
182
-	$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) {
183
-		$eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
182
+	$updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($eventSource, $l) {
183
+		$eventSource->send('success', (string) $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app]));
184 184
 	});
185
-	$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) {
186
-		$eventSource->send('success', (string)$l->t('Checked database schema update for apps'));
185
+	$updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($eventSource, $l) {
186
+		$eventSource->send('success', (string) $l->t('Checked database schema update for apps'));
187 187
 	});
188
-	$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) {
189
-		$eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version]));
188
+	$updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($eventSource, $l) {
189
+		$eventSource->send('success', (string) $l->t('Updated "%1$s" to %2$s', [$app, $version]));
190 190
 	});
191
-	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) {
192
-		$incompatibleApps[]= $app;
191
+	$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use (&$incompatibleApps) {
192
+		$incompatibleApps[] = $app;
193 193
 	});
194
-	$updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) {
194
+	$updater->listen('\OC\Updater', 'failure', function($message) use ($eventSource, $config) {
195 195
 		$eventSource->send('failure', $message);
196 196
 		$eventSource->close();
197 197
 		$config->setSystemValue('maintenance', false);
198 198
 	});
199
-	$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($eventSource, $l) {
200
-		$eventSource->send('success', (string)$l->t('Set log level to debug'));
199
+	$updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use($eventSource, $l) {
200
+		$eventSource->send('success', (string) $l->t('Set log level to debug'));
201 201
 	});
202
-	$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($eventSource, $l) {
203
-		$eventSource->send('success', (string)$l->t('Reset log level'));
202
+	$updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($eventSource, $l) {
203
+		$eventSource->send('success', (string) $l->t('Reset log level'));
204 204
 	});
205
-	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($eventSource, $l) {
206
-		$eventSource->send('success', (string)$l->t('Starting code integrity check'));
205
+	$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($eventSource, $l) {
206
+		$eventSource->send('success', (string) $l->t('Starting code integrity check'));
207 207
 	});
208
-	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($eventSource, $l) {
209
-		$eventSource->send('success', (string)$l->t('Finished code integrity check'));
208
+	$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($eventSource, $l) {
209
+		$eventSource->send('success', (string) $l->t('Finished code integrity check'));
210 210
 	});
211 211
 
212 212
 	try {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			'level' => ILogger::ERROR,
217 217
 			'app' => 'update',
218 218
 		]);
219
-		$eventSource->send('failure', get_class($e) . ': ' . $e->getMessage());
219
+		$eventSource->send('failure', get_class($e).': '.$e->getMessage());
220 220
 		$eventSource->close();
221 221
 		exit();
222 222
 	}
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 
229 229
 	if (!empty($disabledApps)) {
230 230
 		$eventSource->send('notice',
231
-			(string)$l->t('Following apps have been disabled: %s', [implode(', ', $disabledApps)]));
231
+			(string) $l->t('Following apps have been disabled: %s', [implode(', ', $disabledApps)]));
232 232
 	}
233 233
 } else {
234
-	$eventSource->send('notice', (string)$l->t('Already up to date'));
234
+	$eventSource->send('notice', (string) $l->t('Already up to date'));
235 235
 }
236 236
 
237 237
 $eventSource->send('done', '');
Please login to merge, or discard this patch.
core/Command/User/Report.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,10 +54,10 @@
 block discarded – undo
54 54
 		$table = new Table($output);
55 55
 		$table->setHeaders(['User Report', '']);
56 56
 		$userCountArray = $this->countUsers();
57
-		if(!empty($userCountArray)) {
57
+		if (!empty($userCountArray)) {
58 58
 			$total = 0;
59 59
 			$rows = [];
60
-			foreach($userCountArray as $classname => $users) {
60
+			foreach ($userCountArray as $classname => $users) {
61 61
 				$total += $users;
62 62
 				$rows[] = [$classname, $users];
63 63
 			}
Please login to merge, or discard this patch.
core/Command/Upgrade.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	protected function execute(InputInterface $input, OutputInterface $output) {
88 88
 
89
-		if(Util::needUpgrade()) {
89
+		if (Util::needUpgrade()) {
90 90
 			if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
91 91
 				// Prepend each line with a little timestamp
92 92
 				$timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter());
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 				if ($event instanceof GenericEvent) {
109 109
 					$message = $event->getSubject();
110 110
 					if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
111
-						$output->writeln(' Checking table ' . $message);
111
+						$output->writeln(' Checking table '.$message);
112 112
 					} else {
113 113
 						if (strlen($message) > 60) {
114
-							$message = substr($message, 0, 57) . '...';
114
+							$message = substr($message, 0, 57).'...';
115 115
 						}
116 116
 						$progress->setMessage($message);
117 117
 						if ($event[0] === 1) {
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 						$output->writeln('');
153 153
 						break;
154 154
 					case '\OC\Repair::step':
155
-						if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
156
-							$output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>');
155
+						if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
156
+							$output->writeln('<info>Repair step: '.$event->getArgument(0).'</info>');
157 157
 						}
158 158
 						break;
159 159
 					case '\OC\Repair::info':
160
-						if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
161
-							$output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>');
160
+						if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
161
+							$output->writeln('<info>Repair info: '.$event->getArgument(0).'</info>');
162 162
 						}
163 163
 						break;
164 164
 					case '\OC\Repair::warning':
165
-						$output->writeln('<error>Repair warning: ' . $event->getArgument(0) . '</error>');
165
+						$output->writeln('<error>Repair warning: '.$event->getArgument(0).'</error>');
166 166
 						break;
167 167
 					case '\OC\Repair::error':
168
-						$output->writeln('<error>Repair error: ' . $event->getArgument(0) . '</error>');
168
+						$output->writeln('<error>Repair error: '.$event->getArgument(0).'</error>');
169 169
 						break;
170 170
 				}
171 171
 			};
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 			$dispatcher->addListener('\OC\Repair::error', $repairListener);
182 182
 
183 183
 
184
-			$updater->listen('\OC\Updater', 'maintenanceEnabled', function () use($output) {
184
+			$updater->listen('\OC\Updater', 'maintenanceEnabled', function() use($output) {
185 185
 				$output->writeln('<info>Turned on maintenance mode</info>');
186 186
 			});
187
-			$updater->listen('\OC\Updater', 'maintenanceDisabled', function () use($output) {
187
+			$updater->listen('\OC\Updater', 'maintenanceDisabled', function() use($output) {
188 188
 				$output->writeln('<info>Turned off maintenance mode</info>');
189 189
 			});
190
-			$updater->listen('\OC\Updater', 'maintenanceActive', function () use($output) {
190
+			$updater->listen('\OC\Updater', 'maintenanceActive', function() use($output) {
191 191
 				$output->writeln('<info>Maintenance mode is kept active</info>');
192 192
 			});
193 193
 			$updater->listen('\OC\Updater', 'updateEnd',
194
-				function ($success) use($output, $self) {
194
+				function($success) use($output, $self) {
195 195
 					if ($success) {
196 196
 						$message = "<info>Update successful</info>";
197 197
 					} else {
@@ -199,58 +199,58 @@  discard block
 block discarded – undo
199 199
 					}
200 200
 					$output->writeln($message);
201 201
 				});
202
-			$updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($output) {
202
+			$updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use($output) {
203 203
 				$output->writeln('<info>Updating database schema</info>');
204 204
 			});
205
-			$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
205
+			$updater->listen('\OC\Updater', 'dbUpgrade', function() use($output) {
206 206
 				$output->writeln('<info>Updated database</info>');
207 207
 			});
208
-			$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($output) {
208
+			$updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($output) {
209 209
 				$output->writeln('<info>Checking whether the database schema can be updated (this can take a long time depending on the database size)</info>');
210 210
 			});
211
-			$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($output) {
211
+			$updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($output) {
212 212
 				$output->writeln('<info>Checked database schema update</info>');
213 213
 			});
214
-			$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($output) {
215
-				$output->writeln('<comment>Disabled incompatible app: ' . $app . '</comment>');
214
+			$updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($output) {
215
+				$output->writeln('<comment>Disabled incompatible app: '.$app.'</comment>');
216 216
 			});
217
-			$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($output) {
218
-				$output->writeln('<info>Checking for update of app ' . $app . ' in appstore</info>');
217
+			$updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($output) {
218
+				$output->writeln('<info>Checking for update of app '.$app.' in appstore</info>');
219 219
 			});
220
-			$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($output) {
221
-				$output->writeln('<info>Update app ' . $app . ' from appstore</info>');
220
+			$updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($output) {
221
+				$output->writeln('<info>Update app '.$app.' from appstore</info>');
222 222
 			});
223
-			$updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($output) {
224
-				$output->writeln('<info>Checked for update of app "' . $app . '" in appstore </info>');
223
+			$updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($output) {
224
+				$output->writeln('<info>Checked for update of app "'.$app.'" in appstore </info>');
225 225
 			});
226
-			$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($output) {
226
+			$updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($output) {
227 227
 				$output->writeln('<info>Checking updates of apps</info>');
228 228
 			});
229
-			$updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output) {
229
+			$updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($output) {
230 230
 				$output->writeln("<info>Checking whether the database schema for <$app> can be updated (this can take a long time depending on the database size)</info>");
231 231
 			});
232
-			$updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($output) {
232
+			$updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($output) {
233 233
 				$output->writeln('<info>Checked database schema update for apps</info>');
234 234
 			});
235
-			$updater->listen('\OC\Updater', 'appUpgradeStarted', function ($app, $version) use ($output) {
235
+			$updater->listen('\OC\Updater', 'appUpgradeStarted', function($app, $version) use ($output) {
236 236
 				$output->writeln("<info>Updating <$app> ...</info>");
237 237
 			});
238
-			$updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) {
238
+			$updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($output) {
239 239
 				$output->writeln("<info>Updated <$app> to $version</info>");
240 240
 			});
241
-			$updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) {
241
+			$updater->listen('\OC\Updater', 'failure', function($message) use($output, $self) {
242 242
 				$output->writeln("<error>$message</error>");
243 243
 			});
244
-			$updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($output) {
244
+			$updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use($output) {
245 245
 				$output->writeln("<info>Set log level to debug</info>");
246 246
 			});
247
-			$updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($output) {
247
+			$updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($output) {
248 248
 				$output->writeln("<info>Reset log level</info>");
249 249
 			});
250
-			$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($output) {
250
+			$updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($output) {
251 251
 				$output->writeln("<info>Starting code integrity check...</info>");
252 252
 			});
253
-			$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($output) {
253
+			$updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($output) {
254 254
 				$output->writeln("<info>Finished code integrity check</info>");
255 255
 			});
256 256
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 			$this->postUpgradeCheck($input, $output);
260 260
 
261
-			if(!$success) {
261
+			if (!$success) {
262 262
 				return self::ERROR_FAILURE;
263 263
 			}
264 264
 
265 265
 			return self::ERROR_SUCCESS;
266
-		} else if($this->config->getSystemValueBool('maintenance')) {
266
+		} else if ($this->config->getSystemValueBool('maintenance')) {
267 267
 			//Possible scenario: Nextcloud core is updated but an app failed
268 268
 			$output->writeln('<warning>Nextcloud is in maintenance mode</warning>');
269 269
 			$output->write('<comment>Maybe an upgrade is already in process. Please check the '
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		$trustedDomains = $this->config->getSystemValue('trusted_domains', []);
289 289
 		if (empty($trustedDomains)) {
290 290
 			$output->write(
291
-				'<warning>The setting "trusted_domains" could not be ' .
292
-				'set automatically by the upgrade script, ' .
291
+				'<warning>The setting "trusted_domains" could not be '.
292
+				'set automatically by the upgrade script, '.
293 293
 				'please set it manually</warning>'
294 294
 			);
295 295
 		}
Please login to merge, or discard this patch.
core/Command/L10n/CreateJs.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 		}
64 64
 		$languages = $lang;
65 65
 		if (empty($lang)) {
66
-			$languages= $this->getAllLanguages($path);
66
+			$languages = $this->getAllLanguages($path);
67 67
 		}
68 68
 
69
-		foreach($languages as $lang) {
69
+		foreach ($languages as $lang) {
70 70
 			$this->writeFiles($app, $path, $lang, $output);
71 71
 		}
72 72
 	}
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 	private function getAllLanguages($path) {
75 75
 		$result = [];
76 76
 		foreach (new DirectoryIterator("$path/l10n") as $fileInfo) {
77
-			if($fileInfo->isDot()) {
77
+			if ($fileInfo->isDot()) {
78 78
 				continue;
79 79
 			}
80
-			if($fileInfo->isDir()) {
80
+			if ($fileInfo->isDir()) {
81 81
 				continue;
82 82
 			}
83
-			if($fileInfo->getExtension() !== 'php') {
83
+			if ($fileInfo->getExtension() !== 'php') {
84 84
 				continue;
85 85
 			}
86
-			$result[]= substr($fileInfo->getBasename(), 0, -4);
86
+			$result[] = substr($fileInfo->getBasename(), 0, -4);
87 87
 		}
88 88
 
89 89
 		return $result;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$jsTrans = [];
106 106
 		foreach ($translations as $id => $val) {
107 107
 			if (is_array($val)) {
108
-				$val = '[ ' . implode(',', $val) . ']';
108
+				$val = '[ '.implode(',', $val).']';
109 109
 			}
110 110
 			$jsTrans[] = "\"$id\" : \"$val\"";
111 111
 		}
Please login to merge, or discard this patch.
core/templates/installation.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
 <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
10 10
 <form action="index.php" method="post">
11 11
 <input type="hidden" name="install" value="true">
12
-	<?php if(count($_['errors']) > 0): ?>
12
+	<?php if (count($_['errors']) > 0): ?>
13 13
 	<fieldset class="warning">
14
-		<legend><strong><?php p($l->t('Error'));?></strong></legend>
15
-		<?php foreach($_['errors'] as $err): ?>
14
+		<legend><strong><?php p($l->t('Error')); ?></strong></legend>
15
+		<?php foreach ($_['errors'] as $err): ?>
16 16
 		<p>
17
-			<?php if(is_array($err)):?>
17
+			<?php if (is_array($err)):?>
18 18
 				<?php p($err['error']); ?>
19 19
 				<span class='hint'><?php p($err['hint']); ?></span>
20 20
 			<?php else: ?>
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 		<?php endforeach; ?>
25 25
 	</fieldset>
26 26
 	<?php endif; ?>
27
-	<?php if(!$_['htaccessWorking']): ?>
27
+	<?php if (!$_['htaccessWorking']): ?>
28 28
 	<fieldset class="warning">
29
-		<legend><strong><?php p($l->t('Security warning'));?></strong></legend>
30
-		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
29
+		<legend><strong><?php p($l->t('Security warning')); ?></strong></legend>
30
+		<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.')); ?><br>
31 31
 		<?php print_unescaped($l->t(
32 32
 			'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
33 33
 			[link_to_docs('admin-install')]
@@ -35,35 +35,35 @@  discard block
 block discarded – undo
35 35
 	</fieldset>
36 36
 	<?php endif; ?>
37 37
 	<fieldset id="adminaccount">
38
-		<legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend>
38
+		<legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend>
39 39
 		<p class="grouptop">
40 40
 			<input type="text" name="adminlogin" id="adminlogin"
41
-				placeholder="<?php p($l->t( 'Username' )); ?>"
41
+				placeholder="<?php p($l->t('Username')); ?>"
42 42
 				value="<?php p($_['adminlogin']); ?>"
43 43
 				autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required>
44
-			<label for="adminlogin" class="infield"><?php p($l->t( 'Username' )); ?></label>
44
+			<label for="adminlogin" class="infield"><?php p($l->t('Username')); ?></label>
45 45
 		</p>
46 46
 		<p class="groupbottom">
47 47
 			<input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
48
-				placeholder="<?php p($l->t( 'Password' )); ?>"
48
+				placeholder="<?php p($l->t('Password')); ?>"
49 49
 				value="<?php p($_['adminpass']); ?>"
50 50
 				autocomplete="off" autocapitalize="none" autocorrect="off" required>
51
-			<label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label>
51
+			<label for="adminpass" class="infield"><?php p($l->t('Password')); ?></label>
52 52
 			<input type="checkbox" id="show" class="hidden-visually" name="show">
53
-			<label for="show" class="hidden-visually"><?php p($l->t( 'Show password')); ?></label>
53
+			<label for="show" class="hidden-visually"><?php p($l->t('Show password')); ?></label>
54 54
 		</p>
55 55
 	</fieldset>
56 56
 
57
-	<?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
57
+	<?php if (!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
58 58
 	<fieldset id="advancedHeader">
59
-		<legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t( 'Storage & database' )); ?><img src="<?php print_unescaped(image_path('', 'actions/caret-white.svg')); ?>" /></a></legend>
59
+		<legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('', 'actions/caret-white.svg')); ?>" /></a></legend>
60 60
 	</fieldset>
61 61
 	<?php endif; ?>
62 62
 
63
-	<?php if(!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
63
+	<?php if (!$_['directoryIsSet'] OR count($_['errors']) > 0): ?>
64 64
 	<fieldset id="datadirField">
65 65
 		<div id="datadirContent">
66
-			<label for="directory"><?php p($l->t( 'Data folder' )); ?></label>
66
+			<label for="directory"><?php p($l->t('Data folder')); ?></label>
67 67
 			<input type="text" name="directory" id="directory"
68 68
 				placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>"
69 69
 				value="<?php p($_['directory']); ?>"
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	</fieldset>
73 73
 	<?php endif; ?>
74 74
 
75
-	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
75
+	<?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
76 76
 	<fieldset id='databaseBackend'>
77
-		<?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
78
-			$hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?>
79
-		<legend><?php p($l->t( 'Configure the database' )); ?></legend>
77
+		<?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'])
78
+			$hasOtherDB = true; else $hasOtherDB = false; //other than SQLite ?>
79
+		<legend><?php p($l->t('Configure the database')); ?></legend>
80 80
 		<div id="selectDbType">
81
-		<?php foreach($_['databases'] as $type => $label): ?>
82
-		<?php if(count($_['databases']) === 1): ?>
81
+		<?php foreach ($_['databases'] as $type => $label): ?>
82
+		<?php if (count($_['databases']) === 1): ?>
83 83
 		<p class="info">
84
-			<?php p($l->t( 'Only %s is available.', [$label] )); ?>
85
-			<?php p($l->t( 'Install and activate additional PHP modules to choose other database types.' )); ?><br>
84
+			<?php p($l->t('Only %s is available.', [$label])); ?>
85
+			<?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br>
86 86
 			<a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer noopener">
87
-				<?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a>
87
+				<?php p($l->t('For more details check out the documentation.')); ?> ↗</a>
88 88
 		</p>
89 89
 		<input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>">
90 90
 		<?php else: ?>
@@ -96,64 +96,64 @@  discard block
 block discarded – undo
96 96
 		</div>
97 97
 	</fieldset>
98 98
 
99
-		<?php if($hasOtherDB): ?>
99
+		<?php if ($hasOtherDB): ?>
100 100
 		<fieldset id='databaseField'>
101 101
 		<div id="use_other_db">
102 102
 			<p class="grouptop">
103
-				<label for="dbuser" class="infield"><?php p($l->t( 'Database user' )); ?></label>
103
+				<label for="dbuser" class="infield"><?php p($l->t('Database user')); ?></label>
104 104
 				<input type="text" name="dbuser" id="dbuser"
105
-					placeholder="<?php p($l->t( 'Database user' )); ?>"
105
+					placeholder="<?php p($l->t('Database user')); ?>"
106 106
 					value="<?php p($_['dbuser']); ?>"
107 107
 					autocomplete="off" autocapitalize="none" autocorrect="off">
108 108
 			</p>
109 109
 			<p class="groupmiddle">
110 110
 				<input type="password" name="dbpass" id="dbpass" data-typetoggle="#dbpassword-toggle"
111
-					placeholder="<?php p($l->t( 'Database password' )); ?>"
111
+					placeholder="<?php p($l->t('Database password')); ?>"
112 112
 					value="<?php p($_['dbpass']); ?>"
113 113
 					autocomplete="off" autocapitalize="none" autocorrect="off">
114
-				<label for="dbpass" class="infield"><?php p($l->t( 'Database password' )); ?></label>
114
+				<label for="dbpass" class="infield"><?php p($l->t('Database password')); ?></label>
115 115
 				<input type="checkbox" id="dbpassword-toggle" class="hidden-visually" name="dbpassword-toggle">
116 116
 				<label for="dbpassword-toggle"></label>
117 117
 			</p>
118 118
 			<p class="groupmiddle">
119
-				<label for="dbname" class="infield"><?php p($l->t( 'Database name' )); ?></label>
119
+				<label for="dbname" class="infield"><?php p($l->t('Database name')); ?></label>
120 120
 				<input type="text" name="dbname" id="dbname"
121
-					placeholder="<?php p($l->t( 'Database name' )); ?>"
121
+					placeholder="<?php p($l->t('Database name')); ?>"
122 122
 					value="<?php p($_['dbname']); ?>"
123 123
 					autocomplete="off" autocapitalize="none" autocorrect="off"
124 124
 					pattern="[0-9a-zA-Z$_-]+">
125 125
 			</p>
126
-			<?php if($_['hasOracle']): ?>
126
+			<?php if ($_['hasOracle']): ?>
127 127
 			<div id="use_oracle_db">
128 128
 				<p class="groupmiddle">
129
-					<label for="dbtablespace" class="infield"><?php p($l->t( 'Database tablespace' )); ?></label>
129
+					<label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label>
130 130
 					<input type="text" name="dbtablespace" id="dbtablespace"
131
-						placeholder="<?php p($l->t( 'Database tablespace' )); ?>"
131
+						placeholder="<?php p($l->t('Database tablespace')); ?>"
132 132
 						value="<?php p($_['dbtablespace']); ?>"
133 133
 						autocomplete="off" autocapitalize="none" autocorrect="off">
134 134
 				</p>
135 135
 			</div>
136 136
 			<?php endif; ?>
137 137
 			<p class="groupbottom">
138
-				<label for="dbhost" class="infield"><?php p($l->t( 'Database host' )); ?></label>
138
+				<label for="dbhost" class="infield"><?php p($l->t('Database host')); ?></label>
139 139
 				<input type="text" name="dbhost" id="dbhost"
140
-					placeholder="<?php p($l->t( 'Database host' )); ?>"
140
+					placeholder="<?php p($l->t('Database host')); ?>"
141 141
 					value="<?php p($_['dbhost']); ?>"
142 142
 					autocomplete="off" autocapitalize="none" autocorrect="off">
143 143
 			</p>
144 144
 			<p class="info">
145
-				<?php p($l->t( 'Please specify the port number along with the host name (e.g., localhost:5432).' )); ?>
145
+				<?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?>
146 146
 			</p>
147 147
 		</div>
148 148
 		</fieldset>
149 149
 		<?php endif; ?>
150 150
 	<?php endif; ?>
151 151
 
152
-	<?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
152
+	<?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?>
153 153
 		<fieldset id="sqliteInformation" class="warning">
154
-			<legend><?php p($l->t('Performance warning'));?></legend>
155
-			<p><?php p($l->t('You chose SQLite as database.'));?></p>
156
-			<p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.'));?></p>
154
+			<legend><?php p($l->t('Performance warning')); ?></legend>
155
+			<p><?php p($l->t('You chose SQLite as database.')); ?></p>
156
+			<p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.')); ?></p>
157 157
 			<p><?php p($l->t('If you use clients for file syncing, the use of SQLite is highly discouraged.')); ?></p>
158 158
 		</fieldset>
159 159
 	<?php endif ?>
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 		<p class="info">
163 163
 			<input type="checkbox" id="install-recommended-apps" name="install-recommended-apps" class="checkbox checkbox--white" checked>
164 164
 			<label for="install-recommended-apps">
165
-				<?php p($l->t( 'Install recommended apps' )); ?>
166
-				<span><?php p($l->t( 'Calendar, Contacts, Talk, Mail & OnlyOffice' )); ?></span>
165
+				<?php p($l->t('Install recommended apps')); ?>
166
+				<span><?php p($l->t('Calendar, Contacts, Talk, Mail & OnlyOffice')); ?></span>
167 167
 			</label>
168 168
 		</p>
169 169
 	</fieldset>
170 170
 
171 171
 	<div class="icon-loading-dark float-spinner">&nbsp;</div>
172 172
 
173
-	<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div>
173
+	<div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Finish setup')); ?>" data-finishing="<?php p($l->t('Finishing …')); ?>"></div>
174 174
 
175 175
 	<p class="info">
176 176
 		<span class="icon-info-white"></span>
177
-		<?php p($l->t('Need help?'));?>
178
-		<a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a>
177
+		<?php p($l->t('Need help?')); ?>
178
+		<a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation')); ?> ↗</a>
179 179
 	</p>
180 180
 </form>
Please login to merge, or discard this patch.
core/Controller/SetupController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 			return;
72 72
 		}
73 73
 
74
-		if(isset($post['install']) AND $post['install']=='true') {
74
+		if (isset($post['install']) AND $post['install'] == 'true') {
75 75
 			// We have to launch the installation process :
76 76
 			$e = $this->setupHelper->install($post);
77 77
 			$errors = ['errors' => $e];
78 78
 
79
-			if(count($e) > 0) {
79
+			if (count($e) > 0) {
80 80
 				$options = array_merge($opts, $post, $errors);
81 81
 				$this->display($options);
82 82
 			} else {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	private function finishSetup(bool $installRecommended) {
113
-		if( file_exists( $this->autoConfigFile )) {
113
+		if (file_exists($this->autoConfigFile)) {
114 114
 			unlink($this->autoConfigFile);
115 115
 		}
116 116
 		\OC::$server->getIntegrityCodeChecker()->runInstanceVerification();
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
 		if ($installRecommended) {
125 125
 			$urlGenerator = \OC::$server->getURLGenerator();
126 126
 			$location = $urlGenerator->getAbsoluteURL('index.php/core/apps/recommended');
127
-			header('Location: ' . $location);
127
+			header('Location: '.$location);
128 128
 			exit();
129 129
 		}
130 130
 		\OC_Util::redirectToDefaultPage();
131 131
 	}
132 132
 
133 133
 	public function loadAutoConfig($post) {
134
-		if( file_exists($this->autoConfigFile)) {
134
+		if (file_exists($this->autoConfigFile)) {
135 135
 			\OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO);
136 136
 			$AUTOCONFIG = [];
137 137
 			include $this->autoConfigFile;
138
-			$post = array_merge ($post, $AUTOCONFIG);
138
+			$post = array_merge($post, $AUTOCONFIG);
139 139
 		}
140 140
 
141 141
 		$dbIsSet = isset($post['dbtype']);
Please login to merge, or discard this patch.
core/Controller/OCSController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 			'extendedSupport' => \OCP\Util::hasExtendedSupport()
102 102
 		];
103 103
 
104
-		if($this->userSession->isLoggedIn()) {
104
+		if ($this->userSession->isLoggedIn()) {
105 105
 			$result['capabilities'] = $this->capabilitiesManager->getCapabilities();
106 106
 		} else {
107 107
 			$result['capabilities'] = $this->capabilitiesManager->getCapabilities(true);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	public function getIdentityProof($cloudId) {
145 145
 		$userObject = $this->userManager->get($cloudId);
146 146
 
147
-		if($userObject !== null) {
147
+		if ($userObject !== null) {
148 148
 			$key = $this->keyManager->getKey($userObject);
149 149
 			$data = [
150 150
 				'public' => $key->getPublic(),
Please login to merge, or discard this patch.
core/Controller/LostController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	protected function checkPasswordResetToken($token, $userId) {
197 197
 		$user = $this->userManager->get($userId);
198
-		if($user === null || !$user->isEnabled()) {
198
+		if ($user === null || !$user->isEnabled()) {
199 199
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
200 200
 		}
201 201
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 		}
213 213
 
214 214
 		$splittedToken = explode(':', $decryptedToken);
215
-		if(count($splittedToken) !== 2) {
215
+		if (count($splittedToken) !== 2) {
216 216
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
217 217
 		}
218 218
 
219
-		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*24*7) ||
219
+		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 24 * 7) ||
220 220
 			$user->getLastLogin() > $splittedToken[0]) {
221 221
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
222 222
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @param array $additional
232 232
 	 * @return array
233 233
 	 */
234
-	private function error($message, array $additional=[]) {
234
+	private function error($message, array $additional = []) {
235 235
 		return array_merge(['status' => 'error', 'msg' => $message], $additional);
236 236
 	}
237 237
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @param string $user
252 252
 	 * @return JSONResponse
253 253
 	 */
254
-	public function email($user){
254
+	public function email($user) {
255 255
 		if ($this->config->getSystemValue('lost_password_link', '') !== '') {
256 256
 			return new JSONResponse($this->error($this->l10n->t('Password reset is disabled')));
257 257
 		}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 			$this->sendEmail($user);
268 268
 		} catch (ResetPasswordException $e) {
269 269
 			// Ignore the error since we do not want to leak this info
270
-			$this->logger->warning('Could not send password reset email: ' . $e->getMessage());
270
+			$this->logger->warning('Could not send password reset email: '.$e->getMessage());
271 271
 		} catch (\Exception $e) {
272 272
 			$this->logger->logException($e);
273 273
 		}
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 
319 319
 			$this->config->deleteUserValue($userId, 'core', 'lostpassword');
320 320
 			@\OC::$server->getUserSession()->unsetMagicInCookie();
321
-		} catch (HintException $e){
321
+		} catch (HintException $e) {
322 322
 			return $this->error($e->getHint());
323
-		} catch (\Exception $e){
323
+		} catch (\Exception $e) {
324 324
 			return $this->error($e->getMessage());
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		$email = $user->getEMailAddress();
338 338
 
339 339
 		if (empty($email)) {
340
-			throw new ResetPasswordException('Could not send reset e-mail since there is no email for username ' . $input);
340
+			throw new ResetPasswordException('Could not send reset e-mail since there is no email for username '.$input);
341 341
 		}
342 342
 
343 343
 		// Generate the token. It is stored encrypted in the database with the
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 			ISecureRandom::CHAR_LOWER.
351 351
 			ISecureRandom::CHAR_UPPER
352 352
 		);
353
-		$tokenValue = $this->timeFactory->getTime() .':'. $token;
354
-		$encryptedValue = $this->crypto->encrypt($tokenValue, $email . $this->config->getSystemValue('secret'));
353
+		$tokenValue = $this->timeFactory->getTime().':'.$token;
354
+		$encryptedValue = $this->crypto->encrypt($tokenValue, $email.$this->config->getSystemValue('secret'));
355 355
 		$this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
356 356
 
357 357
 		$link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 			return $user;
404 404
 		}
405 405
 
406
-		$users = array_filter($this->userManager->getByEmail($input), function (IUser $user) {
406
+		$users = array_filter($this->userManager->getByEmail($input), function(IUser $user) {
407 407
 			return $user->isEnabled();
408 408
 		});
409 409
 
Please login to merge, or discard this patch.