Completed
Pull Request — master (#4098)
by Georg
21:30 queued 08:48
created
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
180 180
 		}
181 181
 
182
-		return (int)$query->execute()->fetchColumn();
182
+		return (int) $query->execute()->fetchColumn();
183 183
 	}
184 184
 
185 185
 	/**
@@ -226,25 +226,25 @@  discard block
 block discarded – undo
226 226
 		$stmt = $query->execute();
227 227
 
228 228
 		$calendars = [];
229
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
229
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
230 230
 
231 231
 			$components = [];
232 232
 			if ($row['components']) {
233
-				$components = explode(',',$row['components']);
233
+				$components = explode(',', $row['components']);
234 234
 			}
235 235
 
236 236
 			$calendar = [
237 237
 				'id' => $row['id'],
238 238
 				'uri' => $row['uri'],
239 239
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
240
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
241
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
242
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
243
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
244
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
240
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
241
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
242
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
243
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
244
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
245 245
 			];
246 246
 
247
-			foreach($this->propertyMap as $xmlName=>$dbName) {
247
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
248 248
 				$calendar[$xmlName] = $row[$dbName];
249 249
 			}
250 250
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 		// query for shared calendars
259 259
 		$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
260
-		$principals[]= $principalUri;
260
+		$principals[] = $principalUri;
261 261
 
262 262
 		$fields = array_values($this->propertyMap);
263 263
 		$fields[] = 'a.id';
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
278 278
 			->execute();
279 279
 
280
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
281
-		while($row = $result->fetch()) {
280
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
281
+		while ($row = $result->fetch()) {
282 282
 			$readOnly = (int) $row['access'] === Backend::ACCESS_READ;
283 283
 			if (isset($calendars[$row['id']])) {
284 284
 				if ($readOnly) {
@@ -293,25 +293,25 @@  discard block
 block discarded – undo
293 293
 			}
294 294
 
295 295
 			list(, $name) = URLUtil::splitPath($row['principaluri']);
296
-			$uri = $row['uri'] . '_shared_by_' . $name;
297
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
296
+			$uri = $row['uri'].'_shared_by_'.$name;
297
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
298 298
 			$components = [];
299 299
 			if ($row['components']) {
300
-				$components = explode(',',$row['components']);
300
+				$components = explode(',', $row['components']);
301 301
 			}
302 302
 			$calendar = [
303 303
 				'id' => $row['id'],
304 304
 				'uri' => $uri,
305 305
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
306
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
307
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
308
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
309
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
310
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
306
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
307
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
308
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
309
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
310
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
311 311
 				$readOnlyPropertyName => $readOnly,
312 312
 			];
313 313
 
314
-			foreach($this->propertyMap as $xmlName=>$dbName) {
314
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
315 315
 				$calendar[$xmlName] = $row[$dbName];
316 316
 			}
317 317
 
@@ -338,21 +338,21 @@  discard block
 block discarded – undo
338 338
 			->orderBy('calendarorder', 'ASC');
339 339
 		$stmt = $query->execute();
340 340
 		$calendars = [];
341
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
341
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
342 342
 			$components = [];
343 343
 			if ($row['components']) {
344
-				$components = explode(',',$row['components']);
344
+				$components = explode(',', $row['components']);
345 345
 			}
346 346
 			$calendar = [
347 347
 				'id' => $row['id'],
348 348
 				'uri' => $row['uri'],
349 349
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
350
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
351
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
352
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
353
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
350
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
351
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
352
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
353
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
354 354
 			];
355
-			foreach($this->propertyMap as $xmlName=>$dbName) {
355
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
356 356
 				$calendar[$xmlName] = $row[$dbName];
357 357
 			}
358 358
 			if (!isset($calendars[$calendar['id']])) {
@@ -400,27 +400,27 @@  discard block
 block discarded – undo
400 400
 			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
401 401
 			->execute();
402 402
 
403
-		while($row = $result->fetch()) {
403
+		while ($row = $result->fetch()) {
404 404
 			list(, $name) = URLUtil::splitPath($row['principaluri']);
405
-			$row['displayname'] = $row['displayname'] . "($name)";
405
+			$row['displayname'] = $row['displayname']."($name)";
406 406
 			$components = [];
407 407
 			if ($row['components']) {
408
-				$components = explode(',',$row['components']);
408
+				$components = explode(',', $row['components']);
409 409
 			}
410 410
 			$calendar = [
411 411
 				'id' => $row['id'],
412 412
 				'uri' => $row['publicuri'],
413 413
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
414
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
415
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
416
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
417
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
418
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
419
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
420
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
414
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
415
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
416
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
417
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
418
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
419
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
420
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
421 421
 			];
422 422
 
423
-			foreach($this->propertyMap as $xmlName=>$dbName) {
423
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
424 424
 				$calendar[$xmlName] = $row[$dbName];
425 425
 			}
426 426
 
@@ -462,29 +462,29 @@  discard block
 block discarded – undo
462 462
 		$result->closeCursor();
463 463
 
464 464
 		if ($row === false) {
465
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
465
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
466 466
 		}
467 467
 
468 468
 		list(, $name) = URLUtil::splitPath($row['principaluri']);
469
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
469
+		$row['displayname'] = $row['displayname'].' '."($name)";
470 470
 		$components = [];
471 471
 		if ($row['components']) {
472
-			$components = explode(',',$row['components']);
472
+			$components = explode(',', $row['components']);
473 473
 		}
474 474
 		$calendar = [
475 475
 			'id' => $row['id'],
476 476
 			'uri' => $row['publicuri'],
477 477
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
478
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
479
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
480
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
481
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
482
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
483
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
484
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
478
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
479
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
480
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
481
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
482
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
483
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
484
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
485 485
 		];
486 486
 
487
-		foreach($this->propertyMap as $xmlName=>$dbName) {
487
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
488 488
 			$calendar[$xmlName] = $row[$dbName];
489 489
 		}
490 490
 
@@ -522,20 +522,20 @@  discard block
 block discarded – undo
522 522
 
523 523
 		$components = [];
524 524
 		if ($row['components']) {
525
-			$components = explode(',',$row['components']);
525
+			$components = explode(',', $row['components']);
526 526
 		}
527 527
 
528 528
 		$calendar = [
529 529
 			'id' => $row['id'],
530 530
 			'uri' => $row['uri'],
531 531
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
532
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
533
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
534
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
535
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
532
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
533
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
534
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
535
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
536 536
 		];
537 537
 
538
-		foreach($this->propertyMap as $xmlName=>$dbName) {
538
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
539 539
 			$calendar[$xmlName] = $row[$dbName];
540 540
 		}
541 541
 
@@ -566,20 +566,20 @@  discard block
 block discarded – undo
566 566
 
567 567
 		$components = [];
568 568
 		if ($row['components']) {
569
-			$components = explode(',',$row['components']);
569
+			$components = explode(',', $row['components']);
570 570
 		}
571 571
 
572 572
 		$calendar = [
573 573
 			'id' => $row['id'],
574 574
 			'uri' => $row['uri'],
575 575
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
576
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
577
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
578
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
579
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
576
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
577
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
578
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
579
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
580 580
 		];
581 581
 
582
-		foreach($this->propertyMap as $xmlName=>$dbName) {
582
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
583 583
 			$calendar[$xmlName] = $row[$dbName];
584 584
 		}
585 585
 
@@ -611,16 +611,16 @@  discard block
 block discarded – undo
611 611
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
612 612
 		if (isset($properties[$sccs])) {
613 613
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
614
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
614
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
615 615
 			}
616
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
616
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
617 617
 		}
618
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
618
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
619 619
 		if (isset($properties[$transp])) {
620
-			$values['transparent'] = $properties[$transp]->getValue()==='transparent';
620
+			$values['transparent'] = $properties[$transp]->getValue() === 'transparent';
621 621
 		}
622 622
 
623
-		foreach($this->propertyMap as $xmlName=>$dbName) {
623
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
624 624
 			if (isset($properties[$xmlName])) {
625 625
 				$values[$dbName] = $properties[$xmlName];
626 626
 			}
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
 		$query = $this->db->getQueryBuilder();
630 630
 		$query->insert('calendars');
631
-		foreach($values as $column => $value) {
631
+		foreach ($values as $column => $value) {
632 632
 			$query->setValue($column, $query->createNamedParameter($value));
633 633
 		}
634 634
 		$query->execute();
@@ -661,14 +661,14 @@  discard block
 block discarded – undo
661 661
 	 */
662 662
 	function updateCalendar($calendarId, PropPatch $propPatch) {
663 663
 		$supportedProperties = array_keys($this->propertyMap);
664
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
664
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
665 665
 
666 666
 		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
667 667
 			$newValues = [];
668 668
 			foreach ($mutations as $propertyName => $propertyValue) {
669 669
 
670 670
 				switch ($propertyName) {
671
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' :
671
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' :
672 672
 						$fieldName = 'transparent';
673 673
 						$newValues[$fieldName] = $propertyValue->getValue() === 'transparent';
674 674
 						break;
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
 		$stmt = $query->execute();
779 779
 
780 780
 		$result = [];
781
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
781
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
782 782
 			$result[] = [
783 783
 					'id'           => $row['id'],
784 784
 					'uri'          => $row['uri'],
785 785
 					'lastmodified' => $row['lastmodified'],
786
-					'etag'         => '"' . $row['etag'] . '"',
786
+					'etag'         => '"'.$row['etag'].'"',
787 787
 					'calendarid'   => $row['calendarid'],
788
-					'size'         => (int)$row['size'],
788
+					'size'         => (int) $row['size'],
789 789
 					'component'    => strtolower($row['componenttype']),
790
-					'classification'=> (int)$row['classification']
790
+					'classification'=> (int) $row['classification']
791 791
 			];
792 792
 		}
793 793
 
@@ -820,18 +820,18 @@  discard block
 block discarded – undo
820 820
 		$stmt = $query->execute();
821 821
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
822 822
 
823
-		if(!$row) return null;
823
+		if (!$row) return null;
824 824
 
825 825
 		return [
826 826
 				'id'            => $row['id'],
827 827
 				'uri'           => $row['uri'],
828 828
 				'lastmodified'  => $row['lastmodified'],
829
-				'etag'          => '"' . $row['etag'] . '"',
829
+				'etag'          => '"'.$row['etag'].'"',
830 830
 				'calendarid'    => $row['calendarid'],
831
-				'size'          => (int)$row['size'],
831
+				'size'          => (int) $row['size'],
832 832
 				'calendardata'  => $this->readBlob($row['calendardata']),
833 833
 				'component'     => strtolower($row['componenttype']),
834
-				'classification'=> (int)$row['classification']
834
+				'classification'=> (int) $row['classification']
835 835
 		];
836 836
 	}
837 837
 
@@ -870,12 +870,12 @@  discard block
 block discarded – undo
870 870
 					'id'           => $row['id'],
871 871
 					'uri'          => $row['uri'],
872 872
 					'lastmodified' => $row['lastmodified'],
873
-					'etag'         => '"' . $row['etag'] . '"',
873
+					'etag'         => '"'.$row['etag'].'"',
874 874
 					'calendarid'   => $row['calendarid'],
875
-					'size'         => (int)$row['size'],
875
+					'size'         => (int) $row['size'],
876 876
 					'calendardata' => $this->readBlob($row['calendardata']),
877 877
 					'component'    => strtolower($row['componenttype']),
878
-					'classification' => (int)$row['classification']
878
+					'classification' => (int) $row['classification']
879 879
 				];
880 880
 			}
881 881
 			$result->closeCursor();
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
 		));
933 933
 		$this->addChange($calendarId, $objectUri, 1);
934 934
 
935
-		return '"' . $extraData['etag'] . '"';
935
+		return '"'.$extraData['etag'].'"';
936 936
 	}
937 937
 
938 938
 	/**
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 		}
986 986
 		$this->addChange($calendarId, $objectUri, 2);
987 987
 
988
-		return '"' . $extraData['etag'] . '"';
988
+		return '"'.$extraData['etag'].'"';
989 989
 	}
990 990
 
991 991
 	/**
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
 		$stmt = $query->execute();
1137 1137
 
1138 1138
 		$result = [];
1139
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1139
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1140 1140
 			if ($requirePostFilter) {
1141 1141
 				if (!$this->validateFilterForObject($row, $filters)) {
1142 1142
 					continue;
@@ -1157,14 +1157,14 @@  discard block
 block discarded – undo
1157 1157
 	 * @param integer|null $offset
1158 1158
 	 * @return array
1159 1159
 	 */
1160
-	public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) {
1160
+	public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1161 1161
 		$calendars = $this->getCalendarsForUser($principalUri);
1162 1162
 		$ownCalendars = [];
1163 1163
 		$sharedCalendars = [];
1164 1164
 
1165 1165
 		$uriMapper = [];
1166 1166
 
1167
-		foreach($calendars as $calendar) {
1167
+		foreach ($calendars as $calendar) {
1168 1168
 			if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1169 1169
 				$ownCalendars[] = $calendar['id'];
1170 1170
 			} else {
@@ -1180,11 +1180,11 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
 		// Calendar id expressions
1182 1182
 		$calendarExpressions = [];
1183
-		foreach($ownCalendars as $id) {
1183
+		foreach ($ownCalendars as $id) {
1184 1184
 			$calendarExpressions[] = $query->expr()
1185 1185
 				->eq('calendarid', $query->createNamedParameter($id));
1186 1186
 		}
1187
-		foreach($sharedCalendars as $id) {
1187
+		foreach ($sharedCalendars as $id) {
1188 1188
 			$calendarExpressions[] = $query->expr()->andX(
1189 1189
 				$query->expr()->eq('calendarid',
1190 1190
 					$query->createNamedParameter($id)),
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
 		// Component expressions
1203 1203
 		$compExpressions = [];
1204
-		foreach($filters['comps'] as $comp) {
1204
+		foreach ($filters['comps'] as $comp) {
1205 1205
 			$compExpressions[] = $query->expr()
1206 1206
 				->eq('componenttype', $query->createNamedParameter($comp));
1207 1207
 		}
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 		// property and filter expression
1216 1216
 		$searchTermFilter = $query->expr()->like('calendardata',
1217
-			$query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%'));
1217
+			$query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'));
1218 1218
 
1219 1219
 		$query->select(['calendarid', 'uri', 'calendardata'])
1220 1220
 			->from('calendarobjects')
@@ -1225,12 +1225,12 @@  discard block
 block discarded – undo
1225 1225
 		$stmt = $query->execute();
1226 1226
 
1227 1227
 		$result = [];
1228
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1228
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1229 1229
 			if (!$this->validateFilterForCalendarSearch($row, $filters)) {
1230 1230
 				continue;
1231 1231
 			}
1232 1232
 
1233
-			$result[] = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1233
+			$result[] = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1234 1234
 		}
1235 1235
 
1236 1236
 		return $result;
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
 		$stmt = $query->execute();
1288 1288
 
1289 1289
 		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1290
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1290
+			return $row['calendaruri'].'/'.$row['objecturi'];
1291 1291
 		}
1292 1292
 
1293 1293
 		return null;
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 	function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
1353 1353
 		// Current synctoken
1354 1354
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
1355
-		$stmt->execute([ $calendarId ]);
1355
+		$stmt->execute([$calendarId]);
1356 1356
 		$currentToken = $stmt->fetchColumn(0);
1357 1357
 
1358 1358
 		if (is_null($currentToken)) {
@@ -1369,8 +1369,8 @@  discard block
 block discarded – undo
1369 1369
 		if ($syncToken) {
1370 1370
 
1371 1371
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`";
1372
-			if ($limit>0) {
1373
-				$query.= " `LIMIT` " . (int)$limit;
1372
+			if ($limit > 0) {
1373
+				$query .= " `LIMIT` ".(int) $limit;
1374 1374
 			}
1375 1375
 
1376 1376
 			// Fetching all changes
@@ -1381,15 +1381,15 @@  discard block
 block discarded – undo
1381 1381
 
1382 1382
 			// This loop ensures that any duplicates are overwritten, only the
1383 1383
 			// last change on a node is relevant.
1384
-			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1384
+			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1385 1385
 
1386 1386
 				$changes[$row['uri']] = $row['operation'];
1387 1387
 
1388 1388
 			}
1389 1389
 
1390
-			foreach($changes as $uri => $operation) {
1390
+			foreach ($changes as $uri => $operation) {
1391 1391
 
1392
-				switch($operation) {
1392
+				switch ($operation) {
1393 1393
 					case 1 :
1394 1394
 						$result['added'][] = $uri;
1395 1395
 						break;
@@ -1459,10 +1459,10 @@  discard block
 block discarded – undo
1459 1459
 			->from('calendarsubscriptions')
1460 1460
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1461 1461
 			->orderBy('calendarorder', 'asc');
1462
-		$stmt =$query->execute();
1462
+		$stmt = $query->execute();
1463 1463
 
1464 1464
 		$subscriptions = [];
1465
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1465
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1466 1466
 
1467 1467
 			$subscription = [
1468 1468
 				'id'           => $row['id'],
@@ -1471,10 +1471,10 @@  discard block
 block discarded – undo
1471 1471
 				'source'       => $row['source'],
1472 1472
 				'lastmodified' => $row['lastmodified'],
1473 1473
 
1474
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1474
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1475 1475
 			];
1476 1476
 
1477
-			foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1477
+			foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1478 1478
 				if (!is_null($row[$dbName])) {
1479 1479
 					$subscription[$xmlName] = $row[$dbName];
1480 1480
 				}
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
 
1514 1514
 		$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
1515 1515
 
1516
-		foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1516
+		foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1517 1517
 			if (array_key_exists($xmlName, $properties)) {
1518 1518
 					$values[$dbName] = $properties[$xmlName];
1519 1519
 					if (in_array($dbName, $propertiesBoolean)) {
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 
1562 1562
 			$newValues = [];
1563 1563
 
1564
-			foreach($mutations as $propertyName=>$propertyValue) {
1564
+			foreach ($mutations as $propertyName=>$propertyValue) {
1565 1565
 				if ($propertyName === '{http://calendarserver.org/ns/}source') {
1566 1566
 					$newValues['source'] = $propertyValue->getHref();
1567 1567
 				} else {
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
 			$query = $this->db->getQueryBuilder();
1574 1574
 			$query->update('calendarsubscriptions')
1575 1575
 				->set('lastmodified', $query->createNamedParameter(time()));
1576
-			foreach($newValues as $fieldName=>$value) {
1576
+			foreach ($newValues as $fieldName=>$value) {
1577 1577
 				$query->set($fieldName, $query->createNamedParameter($value));
1578 1578
 			}
1579 1579
 			$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
 
1624 1624
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
1625 1625
 
1626
-		if(!$row) {
1626
+		if (!$row) {
1627 1627
 			return null;
1628 1628
 		}
1629 1629
 
@@ -1631,8 +1631,8 @@  discard block
 block discarded – undo
1631 1631
 				'uri'          => $row['uri'],
1632 1632
 				'calendardata' => $row['calendardata'],
1633 1633
 				'lastmodified' => $row['lastmodified'],
1634
-				'etag'         => '"' . $row['etag'] . '"',
1635
-				'size'         => (int)$row['size'],
1634
+				'etag'         => '"'.$row['etag'].'"',
1635
+				'size'         => (int) $row['size'],
1636 1636
 		];
1637 1637
 	}
1638 1638
 
@@ -1655,13 +1655,13 @@  discard block
 block discarded – undo
1655 1655
 				->execute();
1656 1656
 
1657 1657
 		$result = [];
1658
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
1658
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
1659 1659
 			$result[] = [
1660 1660
 					'calendardata' => $row['calendardata'],
1661 1661
 					'uri'          => $row['uri'],
1662 1662
 					'lastmodified' => $row['lastmodified'],
1663
-					'etag'         => '"' . $row['etag'] . '"',
1664
-					'size'         => (int)$row['size'],
1663
+					'etag'         => '"'.$row['etag'].'"',
1664
+					'size'         => (int) $row['size'],
1665 1665
 			];
1666 1666
 		}
1667 1667
 
@@ -1753,10 +1753,10 @@  discard block
 block discarded – undo
1753 1753
 		$lastOccurrence = null;
1754 1754
 		$uid = null;
1755 1755
 		$classification = self::CLASSIFICATION_PUBLIC;
1756
-		foreach($vObject->getComponents() as $component) {
1757
-			if ($component->name!=='VTIMEZONE') {
1756
+		foreach ($vObject->getComponents() as $component) {
1757
+			if ($component->name !== 'VTIMEZONE') {
1758 1758
 				$componentType = $component->name;
1759
-				$uid = (string)$component->UID;
1759
+				$uid = (string) $component->UID;
1760 1760
 				break;
1761 1761
 			}
1762 1762
 		}
@@ -1781,13 +1781,13 @@  discard block
 block discarded – undo
1781 1781
 					$lastOccurrence = $firstOccurrence;
1782 1782
 				}
1783 1783
 			} else {
1784
-				$it = new EventIterator($vObject, (string)$component->UID);
1784
+				$it = new EventIterator($vObject, (string) $component->UID);
1785 1785
 				$maxDate = new \DateTime(self::MAX_DATE);
1786 1786
 				if ($it->isInfinite()) {
1787 1787
 					$lastOccurrence = $maxDate->getTimestamp();
1788 1788
 				} else {
1789 1789
 					$end = $it->getDtEnd();
1790
-					while($it->valid() && $end < $maxDate) {
1790
+					while ($it->valid() && $end < $maxDate) {
1791 1791
 						$end = $it->getDtEnd();
1792 1792
 						$it->next();
1793 1793
 
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/CalendarSearchValidator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$filters['comps'][] = 'VTIMEZONE';
39 39
 
40 40
 		$matches = false;
41
-		foreach($comps as $comp) {
41
+		foreach ($comps as $comp) {
42 42
 			if ($comp->name === 'VTIMEZONE') {
43 43
 				continue;
44 44
 			}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			}
53 53
 
54 54
 			$children = $comp->children();
55
-			foreach($children as $child) {
55
+			foreach ($children as $child) {
56 56
 				if (!($child instanceof VObject\Property)) {
57 57
 					continue;
58 58
 				}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 					break;
61 61
 				}
62 62
 
63
-				foreach($filters['props'] as $prop) {
63
+				foreach ($filters['props'] as $prop) {
64 64
 					if ($child->name !== $prop) {
65 65
 						continue;
66 66
 					}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 					}
73 73
 				}
74 74
 
75
-				foreach($filters['params'] as $param) {
75
+				foreach ($filters['params'] as $param) {
76 76
 					$propName = $param['property'];
77 77
 					$paramName = $param['parameter'];
78 78
 
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/SearchPlugin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$server->on('report', [$this, 'report']);
76 76
 
77
-		$server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] =
77
+		$server->xml->elementMap['{'.self::NS_Nextcloud.'}calendar-search'] =
78 78
 			'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport';
79 79
 	}
80 80
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	function report($reportName, $report, $path) {
90 90
 		switch ($reportName) {
91
-			case '{' . self::NS_Nextcloud . '}calendar-search' :
91
+			case '{'.self::NS_Nextcloud.'}calendar-search' :
92 92
 				$this->server->transactionType = 'report-nc-calendar-search';
93 93
 				$this->calendarSearch($report);
94 94
 				return false;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		$reports = [];
112 112
 		if ($node instanceof CalendarHome) {
113
-			$reports[] = '{' . self::NS_Nextcloud . '}calendar-search';
113
+			$reports[] = '{'.self::NS_Nextcloud.'}calendar-search';
114 114
 		}
115 115
 
116 116
 		return $reports;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 			foreach ($nodePaths as $path) {
142 142
 				list($properties) = $this->server->getPropertiesForPath(
143
-					$this->server->getRequestUri() . '/' . $path,
143
+					$this->server->getRequestUri().'/'.$path,
144 144
 					$report->properties);
145 145
 				$result[] = $properties;
146 146
 			}
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$reader->parseInnerTree();
40 40
 
41 41
 		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
42
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}comp-filter requires a valid name attribute');
43 43
 		}
44 44
 
45 45
 		return $componentName;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/LimitFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_int($value) && !is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}limit has illegal value');
39 39
 		}
40 40
 
41 41
 		return intval($value);
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/SearchTermFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}search-term has illegal value');
39 39
 		}
40 40
 
41 41
 		return $value;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/OffsetFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	static function xmlDeserialize(Reader $reader) {
36 36
 		$value = $reader->parseInnerTree();
37 37
 		if (!is_int($value) && !is_string($value)) {
38
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
38
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}offset has illegal value');
39 39
 		}
40 40
 
41 41
 		return intval($value);
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/PropFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 		$reader->parseInnerTree();
40 40
 
41 41
 		if (!is_string($componentName)) {
42
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}prop-filter requires a valid name attribute');
42
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}prop-filter requires a valid name attribute');
43 43
 		}
44 44
 
45 45
 		return $componentName;
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Search/Xml/Filter/ParamFilter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
 		$reader->parseInnerTree();
41 41
 
42 42
 		if (!is_string($property)) {
43
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute');
43
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}param-filter requires a valid property attribute');
44 44
 
45 45
 		}
46 46
 		if (!is_string($parameter)) {
47
-			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute');
47
+			throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}param-filter requires a valid parameter attribute');
48 48
 		}
49 49
 
50 50
 		return [
Please login to merge, or discard this patch.