Passed
Push — master ( b48d53...9fd72b )
by Roeland
41:12 queued 17:46
created
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		}
257 257
 
258 258
 		$result = $query->execute();
259
-		$column = (int)$result->fetchOne();
259
+		$column = (int) $result->fetchOne();
260 260
 		$result->closeCursor();
261 261
 		return $column;
262 262
 	}
@@ -316,18 +316,18 @@  discard block
 block discarded – undo
316 316
 			$row['principaluri'] = (string) $row['principaluri'];
317 317
 			$components = [];
318 318
 			if ($row['components']) {
319
-				$components = explode(',',$row['components']);
319
+				$components = explode(',', $row['components']);
320 320
 			}
321 321
 
322 322
 			$calendar = [
323 323
 				'id' => $row['id'],
324 324
 				'uri' => $row['uri'],
325 325
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
326
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
327
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
328
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
329
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
330
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
326
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
327
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
328
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
329
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
330
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
331 331
 			];
332 332
 
333 333
 			foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
 			->setParameter('type', 'calendar')
366 366
 			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
367 367
 
368
-		$result	= $query->execute();
368
+		$result = $query->execute();
369 369
 
370
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
370
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
371 371
 		while ($row = $result->fetch()) {
372 372
 			$row['principaluri'] = (string) $row['principaluri'];
373 373
 			if ($row['principaluri'] === $principalUri) {
@@ -388,21 +388,21 @@  discard block
 block discarded – undo
388 388
 			}
389 389
 
390 390
 			list(, $name) = Uri\split($row['principaluri']);
391
-			$uri = $row['uri'] . '_shared_by_' . $name;
392
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
391
+			$uri = $row['uri'].'_shared_by_'.$name;
392
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
393 393
 			$components = [];
394 394
 			if ($row['components']) {
395
-				$components = explode(',',$row['components']);
395
+				$components = explode(',', $row['components']);
396 396
 			}
397 397
 			$calendar = [
398 398
 				'id' => $row['id'],
399 399
 				'uri' => $uri,
400 400
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
401
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
402
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
403
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
404
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
405
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
401
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
402
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
403
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
404
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
405
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
406 406
 				$readOnlyPropertyName => $readOnly,
407 407
 			];
408 408
 
@@ -443,16 +443,16 @@  discard block
 block discarded – undo
443 443
 			$row['principaluri'] = (string) $row['principaluri'];
444 444
 			$components = [];
445 445
 			if ($row['components']) {
446
-				$components = explode(',',$row['components']);
446
+				$components = explode(',', $row['components']);
447 447
 			}
448 448
 			$calendar = [
449 449
 				'id' => $row['id'],
450 450
 				'uri' => $row['uri'],
451 451
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
452
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
453
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
454
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
455
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
452
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
453
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
454
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
455
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
456 456
 			];
457 457
 			foreach ($this->propertyMap as $xmlName => $dbName) {
458 458
 				$calendar[$xmlName] = $row[$dbName];
@@ -512,22 +512,22 @@  discard block
 block discarded – undo
512 512
 		while ($row = $result->fetch()) {
513 513
 			$row['principaluri'] = (string) $row['principaluri'];
514 514
 			list(, $name) = Uri\split($row['principaluri']);
515
-			$row['displayname'] = $row['displayname'] . "($name)";
515
+			$row['displayname'] = $row['displayname']."($name)";
516 516
 			$components = [];
517 517
 			if ($row['components']) {
518
-				$components = explode(',',$row['components']);
518
+				$components = explode(',', $row['components']);
519 519
 			}
520 520
 			$calendar = [
521 521
 				'id' => $row['id'],
522 522
 				'uri' => $row['publicuri'],
523 523
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
524
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
525
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
526
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
527
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
528
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
529
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
530
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
524
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
525
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
526
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
527
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
528
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
529
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
530
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
531 531
 			];
532 532
 
533 533
 			foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -574,27 +574,27 @@  discard block
 block discarded – undo
574 574
 		$result->closeCursor();
575 575
 
576 576
 		if ($row === false) {
577
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
577
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
578 578
 		}
579 579
 
580 580
 		$row['principaluri'] = (string) $row['principaluri'];
581 581
 		list(, $name) = Uri\split($row['principaluri']);
582
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
582
+		$row['displayname'] = $row['displayname'].' '."($name)";
583 583
 		$components = [];
584 584
 		if ($row['components']) {
585
-			$components = explode(',',$row['components']);
585
+			$components = explode(',', $row['components']);
586 586
 		}
587 587
 		$calendar = [
588 588
 			'id' => $row['id'],
589 589
 			'uri' => $row['publicuri'],
590 590
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
591
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
592
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
593
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
594
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
595
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
596
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
597
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
591
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
592
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
593
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
594
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
595
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
596
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
597
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
598 598
 		];
599 599
 
600 600
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -637,17 +637,17 @@  discard block
 block discarded – undo
637 637
 		$row['principaluri'] = (string) $row['principaluri'];
638 638
 		$components = [];
639 639
 		if ($row['components']) {
640
-			$components = explode(',',$row['components']);
640
+			$components = explode(',', $row['components']);
641 641
 		}
642 642
 
643 643
 		$calendar = [
644 644
 			'id' => $row['id'],
645 645
 			'uri' => $row['uri'],
646 646
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
647
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
648
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
649
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
650
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
647
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
648
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
649
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
650
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
651 651
 		];
652 652
 
653 653
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -688,17 +688,17 @@  discard block
 block discarded – undo
688 688
 		$row['principaluri'] = (string) $row['principaluri'];
689 689
 		$components = [];
690 690
 		if ($row['components']) {
691
-			$components = explode(',',$row['components']);
691
+			$components = explode(',', $row['components']);
692 692
 		}
693 693
 
694 694
 		$calendar = [
695 695
 			'id' => $row['id'],
696 696
 			'uri' => $row['uri'],
697 697
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
698
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
699
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
700
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
701
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
698
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
699
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
700
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
701
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
702 702
 		];
703 703
 
704 704
 		foreach ($this->propertyMap as $xmlName => $dbName) {
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
 			'principaluri' => $row['principaluri'],
743 743
 			'source' => $row['source'],
744 744
 			'lastmodified' => $row['lastmodified'],
745
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
746
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
745
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
746
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
747 747
 		];
748 748
 
749 749
 		foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -780,16 +780,16 @@  discard block
 block discarded – undo
780 780
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
781 781
 		if (isset($properties[$sccs])) {
782 782
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
783
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
783
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
784 784
 			}
785
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
785
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
786 786
 		} elseif (isset($properties['components'])) {
787 787
 			// Allow to provide components internally without having
788 788
 			// to create a SupportedCalendarComponentSet object
789 789
 			$values['components'] = $properties['components'];
790 790
 		}
791 791
 
792
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
792
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
793 793
 		if (isset($properties[$transp])) {
794 794
 			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
795 795
 		}
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 		$calendarId = $query->getLastInsertId();
810 810
 
811 811
 		$calendarData = $this->getCalendarById($calendarId);
812
-		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData));
812
+		$this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData));
813 813
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent(
814 814
 			'\OCA\DAV\CalDAV\CalDavBackend::createCalendar',
815 815
 			[
@@ -838,13 +838,13 @@  discard block
 block discarded – undo
838 838
 	 */
839 839
 	public function updateCalendar($calendarId, PropPatch $propPatch) {
840 840
 		$supportedProperties = array_keys($this->propertyMap);
841
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
841
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
842 842
 
843
-		$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
843
+		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
844 844
 			$newValues = [];
845 845
 			foreach ($mutations as $propertyName => $propertyValue) {
846 846
 				switch ($propertyName) {
847
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
847
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp':
848 848
 						$fieldName = 'transparent';
849 849
 						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
850 850
 						break;
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
 			$calendarData = $this->getCalendarById($calendarId);
868 868
 			$shares = $this->getShares($calendarId);
869
-			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations));
869
+			$this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations));
870 870
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent(
871 871
 				'\OCA\DAV\CalDAV\CalDavBackend::updateCalendar',
872 872
 				[
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 			->execute();
917 917
 
918 918
 		if ($calendarData) {
919
-			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares));
919
+			$this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares));
920 920
 		}
921 921
 	}
922 922
 
@@ -976,11 +976,11 @@  discard block
 block discarded – undo
976 976
 				'id' => $row['id'],
977 977
 				'uri' => $row['uri'],
978 978
 				'lastmodified' => $row['lastmodified'],
979
-				'etag' => '"' . $row['etag'] . '"',
979
+				'etag' => '"'.$row['etag'].'"',
980 980
 				'calendarid' => $row['calendarid'],
981
-				'size' => (int)$row['size'],
981
+				'size' => (int) $row['size'],
982 982
 				'component' => strtolower($row['componenttype']),
983
-				'classification' => (int)$row['classification']
983
+				'classification' => (int) $row['classification']
984 984
 			];
985 985
 		}
986 986
 		$stmt->closeCursor();
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
 			'id' => $row['id'],
1025 1025
 			'uri' => $row['uri'],
1026 1026
 			'lastmodified' => $row['lastmodified'],
1027
-			'etag' => '"' . $row['etag'] . '"',
1027
+			'etag' => '"'.$row['etag'].'"',
1028 1028
 			'calendarid' => $row['calendarid'],
1029
-			'size' => (int)$row['size'],
1029
+			'size' => (int) $row['size'],
1030 1030
 			'calendardata' => $this->readBlob($row['calendardata']),
1031 1031
 			'component' => strtolower($row['componenttype']),
1032
-			'classification' => (int)$row['classification']
1032
+			'classification' => (int) $row['classification']
1033 1033
 		];
1034 1034
 	}
1035 1035
 
@@ -1070,12 +1070,12 @@  discard block
 block discarded – undo
1070 1070
 					'id' => $row['id'],
1071 1071
 					'uri' => $row['uri'],
1072 1072
 					'lastmodified' => $row['lastmodified'],
1073
-					'etag' => '"' . $row['etag'] . '"',
1073
+					'etag' => '"'.$row['etag'].'"',
1074 1074
 					'calendarid' => $row['calendarid'],
1075
-					'size' => (int)$row['size'],
1075
+					'size' => (int) $row['size'],
1076 1076
 					'calendardata' => $this->readBlob($row['calendardata']),
1077 1077
 					'component' => strtolower($row['componenttype']),
1078
-					'classification' => (int)$row['classification']
1078
+					'classification' => (int) $row['classification']
1079 1079
 				];
1080 1080
 			}
1081 1081
 			$result->closeCursor();
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 			$calendarRow = $this->getCalendarById($calendarId);
1148 1148
 			$shares = $this->getShares($calendarId);
1149 1149
 
1150
-			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1150
+			$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow));
1151 1151
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent(
1152 1152
 				'\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject',
1153 1153
 				[
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 		} else {
1161 1161
 			$subscriptionRow = $this->getSubscriptionById($calendarId);
1162 1162
 
1163
-			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1163
+			$this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow));
1164 1164
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent(
1165 1165
 				'\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject',
1166 1166
 				[
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 			));
1173 1173
 		}
1174 1174
 
1175
-		return '"' . $extraData['etag'] . '"';
1175
+		return '"'.$extraData['etag'].'"';
1176 1176
 	}
1177 1177
 
1178 1178
 	/**
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 				$calendarRow = $this->getCalendarById($calendarId);
1222 1222
 				$shares = $this->getShares($calendarId);
1223 1223
 
1224
-				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
1224
+				$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow));
1225 1225
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent(
1226 1226
 					'\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject',
1227 1227
 					[
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 			} else {
1235 1235
 				$subscriptionRow = $this->getSubscriptionById($calendarId);
1236 1236
 
1237
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow));
1237
+				$this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow));
1238 1238
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent(
1239 1239
 					'\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject',
1240 1240
 					[
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 			}
1248 1248
 		}
1249 1249
 
1250
-		return '"' . $extraData['etag'] . '"';
1250
+		return '"'.$extraData['etag'].'"';
1251 1251
 	}
1252 1252
 
1253 1253
 	/**
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 				$calendarRow = $this->getCalendarById($calendarId);
1285 1285
 				$shares = $this->getShares($calendarId);
1286 1286
 
1287
-				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data));
1287
+				$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data));
1288 1288
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent(
1289 1289
 					'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject',
1290 1290
 					[
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 			} else {
1298 1298
 				$subscriptionRow = $this->getSubscriptionById($calendarId);
1299 1299
 
1300
-				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data));
1300
+				$this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data));
1301 1301
 				$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent(
1302 1302
 					'\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject',
1303 1303
 					[
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
 
1570 1570
 		$result = [];
1571 1571
 		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1572
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1572
+			$path = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1573 1573
 			if (!in_array($path, $result)) {
1574 1574
 				$result[] = $path;
1575 1575
 			}
@@ -1617,8 +1617,8 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
 		if ($pattern !== '') {
1619 1619
 			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1620
-				$outerQuery->createNamedParameter('%' .
1621
-					$this->db->escapeLikeParameter($pattern) . '%')));
1620
+				$outerQuery->createNamedParameter('%'.
1621
+					$this->db->escapeLikeParameter($pattern).'%')));
1622 1622
 		}
1623 1623
 
1624 1624
 		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
@@ -1657,7 +1657,7 @@  discard block
 block discarded – undo
1657 1657
 		$result = $outerQuery->execute();
1658 1658
 		$calendarObjects = $result->fetchAll();
1659 1659
 
1660
-		return array_map(function ($o) {
1660
+		return array_map(function($o) {
1661 1661
 			$calendarData = Reader::read($o['calendardata']);
1662 1662
 			$comps = $calendarData->getComponents();
1663 1663
 			$objects = [];
@@ -1675,10 +1675,10 @@  discard block
 block discarded – undo
1675 1675
 				'type' => $o['componenttype'],
1676 1676
 				'uid' => $o['uid'],
1677 1677
 				'uri' => $o['uri'],
1678
-				'objects' => array_map(function ($c) {
1678
+				'objects' => array_map(function($c) {
1679 1679
 					return $this->transformSearchData($c);
1680 1680
 				}, $objects),
1681
-				'timezones' => array_map(function ($c) {
1681
+				'timezones' => array_map(function($c) {
1682 1682
 					return $this->transformSearchData($c);
1683 1683
 				}, $timezones),
1684 1684
 			];
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 		/** @var Component[] $subComponents */
1695 1695
 		$subComponents = $comp->getComponents();
1696 1696
 		/** @var Property[] $properties */
1697
-		$properties = array_filter($comp->children(), function ($c) {
1697
+		$properties = array_filter($comp->children(), function($c) {
1698 1698
 			return $c instanceof Property;
1699 1699
 		});
1700 1700
 		$validationRules = $comp->getValidationRules();
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 		$subscriptions = $this->getSubscriptionsForUser($principalUri);
1773 1773
 		foreach ($calendars as $calendar) {
1774 1774
 			$calendarAnd = $calendarObjectIdQuery->expr()->andX();
1775
-			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])));
1775
+			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])));
1776 1776
 			$calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
1777 1777
 
1778 1778
 			// If it's shared, limit search to public events
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 		}
1786 1786
 		foreach ($subscriptions as $subscription) {
1787 1787
 			$subscriptionAnd = $calendarObjectIdQuery->expr()->andX();
1788
-			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])));
1788
+			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])));
1789 1789
 			$subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)));
1790 1790
 
1791 1791
 			// If it's shared, limit search to public events
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
 			if (!$escapePattern) {
1831 1831
 				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
1832 1832
 			} else {
1833
-				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
1833
+				$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%')));
1834 1834
 			}
1835 1835
 		}
1836 1836
 
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 		$result = $calendarObjectIdQuery->execute();
1845 1845
 		$matches = $result->fetchAll();
1846 1846
 		$result->closeCursor();
1847
-		$matches = array_map(static function (array $match):int {
1847
+		$matches = array_map(static function(array $match):int {
1848 1848
 			return (int) $match['objectid'];
1849 1849
 		}, $matches);
1850 1850
 
@@ -1857,9 +1857,9 @@  discard block
 block discarded – undo
1857 1857
 		$calendarObjects = $result->fetchAll();
1858 1858
 		$result->closeCursor();
1859 1859
 
1860
-		return array_map(function (array $array): array {
1861
-			$array['calendarid'] = (int)$array['calendarid'];
1862
-			$array['calendartype'] = (int)$array['calendartype'];
1860
+		return array_map(function(array $array): array {
1861
+			$array['calendarid'] = (int) $array['calendarid'];
1862
+			$array['calendartype'] = (int) $array['calendartype'];
1863 1863
 			$array['calendardata'] = $this->readBlob($array['calendardata']);
1864 1864
 
1865 1865
 			return $array;
@@ -1896,7 +1896,7 @@  discard block
 block discarded – undo
1896 1896
 		$stmt = $query->execute();
1897 1897
 
1898 1898
 		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1899
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1899
+			return $row['calendaruri'].'/'.$row['objecturi'];
1900 1900
 		}
1901 1901
 
1902 1902
 		return null;
@@ -2096,8 +2096,8 @@  discard block
 block discarded – undo
2096 2096
 				'source' => $row['source'],
2097 2097
 				'lastmodified' => $row['lastmodified'],
2098 2098
 
2099
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2100
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
2099
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
2100
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
2101 2101
 			];
2102 2102
 
2103 2103
 			foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
 		$subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions');
2162 2162
 
2163 2163
 		$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2164
-		$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int)$subscriptionId, $subscriptionRow));
2164
+		$this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int) $subscriptionId, $subscriptionRow));
2165 2165
 		$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent(
2166 2166
 			'\OCA\DAV\CalDAV\CalDavBackend::createSubscription',
2167 2167
 			[
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$supportedProperties = array_keys($this->subscriptionPropertyMap);
2193 2193
 		$supportedProperties[] = '{http://calendarserver.org/ns/}source';
2194 2194
 
2195
-		$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
2195
+		$propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) {
2196 2196
 			$newValues = [];
2197 2197
 
2198 2198
 			foreach ($mutations as $propertyName => $propertyValue) {
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 				->execute();
2215 2215
 
2216 2216
 			$subscriptionRow = $this->getSubscriptionById($subscriptionId);
2217
-			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations));
2217
+			$this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations));
2218 2218
 			$this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent(
2219 2219
 				'\OCA\DAV\CalDAV\CalDavBackend::updateSubscription',
2220 2220
 				[
@@ -2265,7 +2265,7 @@  discard block
 block discarded – undo
2265 2265
 			->execute();
2266 2266
 
2267 2267
 		if ($subscriptionRow) {
2268
-			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, []));
2268
+			$this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, []));
2269 2269
 		}
2270 2270
 	}
2271 2271
 
@@ -2303,8 +2303,8 @@  discard block
 block discarded – undo
2303 2303
 			'uri' => $row['uri'],
2304 2304
 			'calendardata' => $row['calendardata'],
2305 2305
 			'lastmodified' => $row['lastmodified'],
2306
-			'etag' => '"' . $row['etag'] . '"',
2307
-			'size' => (int)$row['size'],
2306
+			'etag' => '"'.$row['etag'].'"',
2307
+			'size' => (int) $row['size'],
2308 2308
 		];
2309 2309
 	}
2310 2310
 
@@ -2332,8 +2332,8 @@  discard block
 block discarded – undo
2332 2332
 				'calendardata' => $row['calendardata'],
2333 2333
 				'uri' => $row['uri'],
2334 2334
 				'lastmodified' => $row['lastmodified'],
2335
-				'etag' => '"' . $row['etag'] . '"',
2336
-				'size' => (int)$row['size'],
2335
+				'etag' => '"'.$row['etag'].'"',
2336
+				'size' => (int) $row['size'],
2337 2337
 			];
2338 2338
 		}
2339 2339
 
@@ -2387,14 +2387,14 @@  discard block
 block discarded – undo
2387 2387
 	 * @return void
2388 2388
 	 */
2389 2389
 	protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) {
2390
-		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions';
2390
+		$table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions';
2391 2391
 
2392 2392
 		$query = $this->db->getQueryBuilder();
2393 2393
 		$query->select('synctoken')
2394 2394
 			->from($table)
2395 2395
 			->where($query->expr()->eq('id', $query->createNamedParameter($calendarId)));
2396 2396
 		$result = $query->execute();
2397
-		$syncToken = (int)$result->fetchOne();
2397
+		$syncToken = (int) $result->fetchOne();
2398 2398
 		$result->closeCursor();
2399 2399
 
2400 2400
 		$query = $this->db->getQueryBuilder();
@@ -2451,7 +2451,7 @@  discard block
 block discarded – undo
2451 2451
 				// Track first component type and uid
2452 2452
 				if ($uid === null) {
2453 2453
 					$componentType = $component->name;
2454
-					$uid = (string)$component->UID;
2454
+					$uid = (string) $component->UID;
2455 2455
 				}
2456 2456
 			}
2457 2457
 		}
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 			]));
2551 2551
 		$this->calendarSharingBackend->updateShares($shareable, $add, $remove);
2552 2552
 
2553
-		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove));
2553
+		$this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove));
2554 2554
 	}
2555 2555
 
2556 2556
 	/**
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
 				]);
2592 2592
 			$query->execute();
2593 2593
 
2594
-			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri));
2594
+			$this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri));
2595 2595
 			return $publicUri;
2596 2596
 		}
2597 2597
 		$query->delete('dav_shares')
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
 			->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC)));
2600 2600
 		$query->execute();
2601 2601
 
2602
-		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData));
2602
+		$this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData));
2603 2603
 		return null;
2604 2604
 	}
2605 2605
 
@@ -2822,10 +2822,10 @@  discard block
 block discarded – undo
2822 2822
 		$result->closeCursor();
2823 2823
 
2824 2824
 		if (!isset($objectIds['id'])) {
2825
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2825
+			throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri);
2826 2826
 		}
2827 2827
 
2828
-		return (int)$objectIds['id'];
2828
+		return (int) $objectIds['id'];
2829 2829
 	}
2830 2830
 
2831 2831
 	/**
@@ -2852,8 +2852,8 @@  discard block
 block discarded – undo
2852 2852
 	 * @param $calendarInfo
2853 2853
 	 */
2854 2854
 	private function addOwnerPrincipal(&$calendarInfo) {
2855
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2856
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2855
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
2856
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
2857 2857
 		if (isset($calendarInfo[$ownerPrincipalKey])) {
2858 2858
 			$uri = $calendarInfo[$ownerPrincipalKey];
2859 2859
 		} else {
Please login to merge, or discard this patch.