Completed
Pull Request — master (#6715)
by Georg
15:12
created
apps/dav/lib/Connector/Sabre/Principal.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$principals = [];
84 84
 
85 85
 		if ($prefixPath === $this->principalPrefix) {
86
-			foreach($this->userManager->search('') as $user) {
86
+			foreach ($this->userManager->search('') as $user) {
87 87
 				$principals[] = $this->userToPrincipal($user);
88 88
 			}
89 89
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 				$groups = $this->groupManager->getUserGroups($user);
151 151
 				$groups = array_map(function($group) {
152 152
 					/** @var IGroup $group */
153
-					return 'principals/groups/' . urlencode($group->getGID());
153
+					return 'principals/groups/'.urlencode($group->getGID());
154 154
 				}, $groups);
155 155
 
156 156
 				return $groups;
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 			switch ($prop) {
197 197
 				case '{http://sabredav.org/ns}email-address':
198 198
 					$users = $this->userManager->getByEmail($value);
199
-					$results[] =  array_map(function ($user) {
200
-						return $this->principalPrefix . '/' . $user->getUID();
199
+					$results[] = array_map(function($user) {
200
+						return $this->principalPrefix.'/'.$user->getUID();
201 201
 					}, $users);
202 202
 					break;
203 203
 				default:
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	function findByUri($uri, $principalPrefix) {
249 249
 		if (substr($uri, 0, 7) === 'mailto:') {
250
-			if ($principalPrefix === principals/users) {
250
+			if ($principalPrefix === principals / users) {
251 251
 				$email = substr($uri, 7);
252 252
 				$users = $this->userManager->getByEmail($email);
253 253
 				if (count($users) === 1) {
254
-					return $this->principalPrefix . '/' . $users[0]->getUID();
254
+					return $this->principalPrefix.'/'.$users[0]->getUID();
255 255
 				}
256 256
 			}
257 257
 		}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		$userId = $user->getUID();
268 268
 		$displayName = $user->getDisplayName();
269 269
 		$principal = [
270
-				'uri' => $this->principalPrefix . '/' . $userId,
270
+				'uri' => $this->principalPrefix.'/'.$userId,
271 271
 				'{DAV:}displayname' => is_null($displayName) ? $userId : $displayName,
272 272
 		];
273 273
 
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
201 201
 		}
202 202
 
203
-		return (int)$query->execute()->fetchColumn();
203
+		return (int) $query->execute()->fetchColumn();
204 204
 	}
205 205
 
206 206
 	/**
@@ -247,25 +247,25 @@  discard block
 block discarded – undo
247 247
 		$stmt = $query->execute();
248 248
 
249 249
 		$calendars = [];
250
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
250
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
251 251
 
252 252
 			$components = [];
253 253
 			if ($row['components']) {
254
-				$components = explode(',',$row['components']);
254
+				$components = explode(',', $row['components']);
255 255
 			}
256 256
 
257 257
 			$calendar = [
258 258
 				'id' => $row['id'],
259 259
 				'uri' => $row['uri'],
260 260
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
261
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
262
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
263
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
264
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
265
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
261
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
262
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
263
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
264
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
265
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
266 266
 			];
267 267
 
268
-			foreach($this->propertyMap as $xmlName=>$dbName) {
268
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
269 269
 				$calendar[$xmlName] = $row[$dbName];
270 270
 			}
271 271
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$principals = array_map(function($principal) {
284 284
 			return urldecode($principal);
285 285
 		}, $principals);
286
-		$principals[]= $principalUri;
286
+		$principals[] = $principalUri;
287 287
 
288 288
 		$fields = array_values($this->propertyMap);
289 289
 		$fields[] = 'a.id';
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
 			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
304 304
 			->execute();
305 305
 
306
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
307
-		while($row = $result->fetch()) {
306
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
307
+		while ($row = $result->fetch()) {
308 308
 			if ($row['principaluri'] === $principalUri) {
309 309
 				continue;
310 310
 			}
@@ -323,25 +323,25 @@  discard block
 block discarded – undo
323 323
 			}
324 324
 
325 325
 			list(, $name) = Uri\split($row['principaluri']);
326
-			$uri = $row['uri'] . '_shared_by_' . $name;
327
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
326
+			$uri = $row['uri'].'_shared_by_'.$name;
327
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
328 328
 			$components = [];
329 329
 			if ($row['components']) {
330
-				$components = explode(',',$row['components']);
330
+				$components = explode(',', $row['components']);
331 331
 			}
332 332
 			$calendar = [
333 333
 				'id' => $row['id'],
334 334
 				'uri' => $uri,
335 335
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
336
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
337
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
338
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
339
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
340
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
336
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
337
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
338
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
339
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'),
340
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
341 341
 				$readOnlyPropertyName => $readOnly,
342 342
 			];
343 343
 
344
-			foreach($this->propertyMap as $xmlName=>$dbName) {
344
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
345 345
 				$calendar[$xmlName] = $row[$dbName];
346 346
 			}
347 347
 
@@ -370,21 +370,21 @@  discard block
 block discarded – undo
370 370
 			->orderBy('calendarorder', 'ASC');
371 371
 		$stmt = $query->execute();
372 372
 		$calendars = [];
373
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
373
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
374 374
 			$components = [];
375 375
 			if ($row['components']) {
376
-				$components = explode(',',$row['components']);
376
+				$components = explode(',', $row['components']);
377 377
 			}
378 378
 			$calendar = [
379 379
 				'id' => $row['id'],
380 380
 				'uri' => $row['uri'],
381 381
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
382
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
383
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
384
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
385
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
382
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
383
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
384
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
385
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
386 386
 			];
387
-			foreach($this->propertyMap as $xmlName=>$dbName) {
387
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
388 388
 				$calendar[$xmlName] = $row[$dbName];
389 389
 			}
390 390
 
@@ -435,27 +435,27 @@  discard block
 block discarded – undo
435 435
 			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
436 436
 			->execute();
437 437
 
438
-		while($row = $result->fetch()) {
438
+		while ($row = $result->fetch()) {
439 439
 			list(, $name) = Uri\split($row['principaluri']);
440
-			$row['displayname'] = $row['displayname'] . "($name)";
440
+			$row['displayname'] = $row['displayname']."($name)";
441 441
 			$components = [];
442 442
 			if ($row['components']) {
443
-				$components = explode(',',$row['components']);
443
+				$components = explode(',', $row['components']);
444 444
 			}
445 445
 			$calendar = [
446 446
 				'id' => $row['id'],
447 447
 				'uri' => $row['publicuri'],
448 448
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
449
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
450
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
451
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
452
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
453
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
454
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
455
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
449
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
450
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
451
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
452
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
453
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
454
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
455
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
456 456
 			];
457 457
 
458
-			foreach($this->propertyMap as $xmlName=>$dbName) {
458
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
459 459
 				$calendar[$xmlName] = $row[$dbName];
460 460
 			}
461 461
 
@@ -499,29 +499,29 @@  discard block
 block discarded – undo
499 499
 		$result->closeCursor();
500 500
 
501 501
 		if ($row === false) {
502
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
502
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
503 503
 		}
504 504
 
505 505
 		list(, $name) = Uri\split($row['principaluri']);
506
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
506
+		$row['displayname'] = $row['displayname'].' '."($name)";
507 507
 		$components = [];
508 508
 		if ($row['components']) {
509
-			$components = explode(',',$row['components']);
509
+			$components = explode(',', $row['components']);
510 510
 		}
511 511
 		$calendar = [
512 512
 			'id' => $row['id'],
513 513
 			'uri' => $row['publicuri'],
514 514
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
515
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
516
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
517
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
518
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
519
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
520
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
521
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
515
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
516
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
517
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
518
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
519
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
520
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
521
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
522 522
 		];
523 523
 
524
-		foreach($this->propertyMap as $xmlName=>$dbName) {
524
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
525 525
 			$calendar[$xmlName] = $row[$dbName];
526 526
 		}
527 527
 
@@ -561,20 +561,20 @@  discard block
 block discarded – undo
561 561
 
562 562
 		$components = [];
563 563
 		if ($row['components']) {
564
-			$components = explode(',',$row['components']);
564
+			$components = explode(',', $row['components']);
565 565
 		}
566 566
 
567 567
 		$calendar = [
568 568
 			'id' => $row['id'],
569 569
 			'uri' => $row['uri'],
570 570
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
571
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
572
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
573
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
574
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
571
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
572
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
573
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
574
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
575 575
 		];
576 576
 
577
-		foreach($this->propertyMap as $xmlName=>$dbName) {
577
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
578 578
 			$calendar[$xmlName] = $row[$dbName];
579 579
 		}
580 580
 
@@ -607,20 +607,20 @@  discard block
 block discarded – undo
607 607
 
608 608
 		$components = [];
609 609
 		if ($row['components']) {
610
-			$components = explode(',',$row['components']);
610
+			$components = explode(',', $row['components']);
611 611
 		}
612 612
 
613 613
 		$calendar = [
614 614
 			'id' => $row['id'],
615 615
 			'uri' => $row['uri'],
616 616
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
617
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
618
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
619
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
620
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
617
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
618
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
619
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
620
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
621 621
 		];
622 622
 
623
-		foreach($this->propertyMap as $xmlName=>$dbName) {
623
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
624 624
 			$calendar[$xmlName] = $row[$dbName];
625 625
 		}
626 626
 
@@ -655,16 +655,16 @@  discard block
 block discarded – undo
655 655
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
656 656
 		if (isset($properties[$sccs])) {
657 657
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
658
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
658
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
659 659
 			}
660
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
660
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
661 661
 		}
662
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
662
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
663 663
 		if (isset($properties[$transp])) {
664 664
 			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
665 665
 		}
666 666
 
667
-		foreach($this->propertyMap as $xmlName=>$dbName) {
667
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
668 668
 			if (isset($properties[$xmlName])) {
669 669
 				$values[$dbName] = $properties[$xmlName];
670 670
 			}
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 
673 673
 		$query = $this->db->getQueryBuilder();
674 674
 		$query->insert('calendars');
675
-		foreach($values as $column => $value) {
675
+		foreach ($values as $column => $value) {
676 676
 			$query->setValue($column, $query->createNamedParameter($value));
677 677
 		}
678 678
 		$query->execute();
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 	 */
707 707
 	function updateCalendar($calendarId, PropPatch $propPatch) {
708 708
 		$supportedProperties = array_keys($this->propertyMap);
709
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
709
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
710 710
 
711 711
 		/**
712 712
 		 * @suppress SqlInjectionChecker
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			foreach ($mutations as $propertyName => $propertyValue) {
717 717
 
718 718
 				switch ($propertyName) {
719
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' :
719
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' :
720 720
 						$fieldName = 'transparent';
721 721
 						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
722 722
 						break;
@@ -831,16 +831,16 @@  discard block
 block discarded – undo
831 831
 		$stmt = $query->execute();
832 832
 
833 833
 		$result = [];
834
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
834
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
835 835
 			$result[] = [
836 836
 					'id'           => $row['id'],
837 837
 					'uri'          => $row['uri'],
838 838
 					'lastmodified' => $row['lastmodified'],
839
-					'etag'         => '"' . $row['etag'] . '"',
839
+					'etag'         => '"'.$row['etag'].'"',
840 840
 					'calendarid'   => $row['calendarid'],
841
-					'size'         => (int)$row['size'],
841
+					'size'         => (int) $row['size'],
842 842
 					'component'    => strtolower($row['componenttype']),
843
-					'classification'=> (int)$row['classification']
843
+					'classification'=> (int) $row['classification']
844 844
 			];
845 845
 		}
846 846
 
@@ -873,18 +873,18 @@  discard block
 block discarded – undo
873 873
 		$stmt = $query->execute();
874 874
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
875 875
 
876
-		if(!$row) return null;
876
+		if (!$row) return null;
877 877
 
878 878
 		return [
879 879
 				'id'            => $row['id'],
880 880
 				'uri'           => $row['uri'],
881 881
 				'lastmodified'  => $row['lastmodified'],
882
-				'etag'          => '"' . $row['etag'] . '"',
882
+				'etag'          => '"'.$row['etag'].'"',
883 883
 				'calendarid'    => $row['calendarid'],
884
-				'size'          => (int)$row['size'],
884
+				'size'          => (int) $row['size'],
885 885
 				'calendardata'  => $this->readBlob($row['calendardata']),
886 886
 				'component'     => strtolower($row['componenttype']),
887
-				'classification'=> (int)$row['classification']
887
+				'classification'=> (int) $row['classification']
888 888
 		];
889 889
 	}
890 890
 
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
 					'id'           => $row['id'],
924 924
 					'uri'          => $row['uri'],
925 925
 					'lastmodified' => $row['lastmodified'],
926
-					'etag'         => '"' . $row['etag'] . '"',
926
+					'etag'         => '"'.$row['etag'].'"',
927 927
 					'calendarid'   => $row['calendarid'],
928
-					'size'         => (int)$row['size'],
928
+					'size'         => (int) $row['size'],
929 929
 					'calendardata' => $this->readBlob($row['calendardata']),
930 930
 					'component'    => strtolower($row['componenttype']),
931
-					'classification' => (int)$row['classification']
931
+					'classification' => (int) $row['classification']
932 932
 				];
933 933
 			}
934 934
 			$result->closeCursor();
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		));
988 988
 		$this->addChange($calendarId, $objectUri, 1);
989 989
 
990
-		return '"' . $extraData['etag'] . '"';
990
+		return '"'.$extraData['etag'].'"';
991 991
 	}
992 992
 
993 993
 	/**
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 		}
1043 1043
 		$this->addChange($calendarId, $objectUri, 2);
1044 1044
 
1045
-		return '"' . $extraData['etag'] . '"';
1045
+		return '"'.$extraData['etag'].'"';
1046 1046
 	}
1047 1047
 
1048 1048
 	/**
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 		$stmt = $query->execute();
1196 1196
 
1197 1197
 		$result = [];
1198
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1198
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1199 1199
 			if ($requirePostFilter) {
1200 1200
 				if (!$this->validateFilterForObject($row, $filters)) {
1201 1201
 					continue;
@@ -1216,14 +1216,14 @@  discard block
 block discarded – undo
1216 1216
 	 * @param integer|null $offset
1217 1217
 	 * @return array
1218 1218
 	 */
1219
-	public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) {
1219
+	public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1220 1220
 		$calendars = $this->getCalendarsForUser($principalUri);
1221 1221
 		$ownCalendars = [];
1222 1222
 		$sharedCalendars = [];
1223 1223
 
1224 1224
 		$uriMapper = [];
1225 1225
 
1226
-		foreach($calendars as $calendar) {
1226
+		foreach ($calendars as $calendar) {
1227 1227
 			if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1228 1228
 				$ownCalendars[] = $calendar['id'];
1229 1229
 			} else {
@@ -1238,11 +1238,11 @@  discard block
 block discarded – undo
1238 1238
 		$query = $this->db->getQueryBuilder();
1239 1239
 		// Calendar id expressions
1240 1240
 		$calendarExpressions = [];
1241
-		foreach($ownCalendars as $id) {
1241
+		foreach ($ownCalendars as $id) {
1242 1242
 			$calendarExpressions[] = $query->expr()
1243 1243
 				->eq('c.calendarid', $query->createNamedParameter($id));
1244 1244
 		}
1245
-		foreach($sharedCalendars as $id) {
1245
+		foreach ($sharedCalendars as $id) {
1246 1246
 			$calendarExpressions[] = $query->expr()->andX(
1247 1247
 				$query->expr()->eq('c.calendarid',
1248 1248
 					$query->createNamedParameter($id)),
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
 		// Component expressions
1261 1261
 		$compExpressions = [];
1262
-		foreach($filters['comps'] as $comp) {
1262
+		foreach ($filters['comps'] as $comp) {
1263 1263
 			$compExpressions[] = $query->expr()
1264 1264
 				->eq('c.componenttype', $query->createNamedParameter($comp));
1265 1265
 		}
@@ -1278,13 +1278,13 @@  discard block
 block discarded – undo
1278 1278
 		}
1279 1279
 
1280 1280
 		$propParamExpressions = [];
1281
-		foreach($filters['props'] as $prop) {
1281
+		foreach ($filters['props'] as $prop) {
1282 1282
 			$propParamExpressions[] = $query->expr()->andX(
1283 1283
 				$query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1284 1284
 				$query->expr()->isNull('i.parameter')
1285 1285
 			);
1286 1286
 		}
1287
-		foreach($filters['params'] as $param) {
1287
+		foreach ($filters['params'] as $param) {
1288 1288
 			$propParamExpressions[] = $query->expr()->andX(
1289 1289
 				$query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1290 1290
 				$query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
@@ -1316,8 +1316,8 @@  discard block
 block discarded – undo
1316 1316
 		$stmt = $query->execute();
1317 1317
 
1318 1318
 		$result = [];
1319
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1320
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1319
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1320
+			$path = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1321 1321
 			if (!in_array($path, $result)) {
1322 1322
 				$result[] = $path;
1323 1323
 			}
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 		$stmt = $query->execute();
1358 1358
 
1359 1359
 		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1360
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1360
+			return $row['calendaruri'].'/'.$row['objecturi'];
1361 1361
 		}
1362 1362
 
1363 1363
 		return null;
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 	function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
1423 1423
 		// Current synctoken
1424 1424
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
1425
-		$stmt->execute([ $calendarId ]);
1425
+		$stmt->execute([$calendarId]);
1426 1426
 		$currentToken = $stmt->fetchColumn(0);
1427 1427
 
1428 1428
 		if (is_null($currentToken)) {
@@ -1439,8 +1439,8 @@  discard block
 block discarded – undo
1439 1439
 		if ($syncToken) {
1440 1440
 
1441 1441
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`";
1442
-			if ($limit>0) {
1443
-				$query.= " LIMIT " . (int)$limit;
1442
+			if ($limit > 0) {
1443
+				$query .= " LIMIT ".(int) $limit;
1444 1444
 			}
1445 1445
 
1446 1446
 			// Fetching all changes
@@ -1451,15 +1451,15 @@  discard block
 block discarded – undo
1451 1451
 
1452 1452
 			// This loop ensures that any duplicates are overwritten, only the
1453 1453
 			// last change on a node is relevant.
1454
-			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1454
+			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1455 1455
 
1456 1456
 				$changes[$row['uri']] = $row['operation'];
1457 1457
 
1458 1458
 			}
1459 1459
 
1460
-			foreach($changes as $uri => $operation) {
1460
+			foreach ($changes as $uri => $operation) {
1461 1461
 
1462
-				switch($operation) {
1462
+				switch ($operation) {
1463 1463
 					case 1 :
1464 1464
 						$result['added'][] = $uri;
1465 1465
 						break;
@@ -1529,10 +1529,10 @@  discard block
 block discarded – undo
1529 1529
 			->from('calendarsubscriptions')
1530 1530
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1531 1531
 			->orderBy('calendarorder', 'asc');
1532
-		$stmt =$query->execute();
1532
+		$stmt = $query->execute();
1533 1533
 
1534 1534
 		$subscriptions = [];
1535
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1535
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1536 1536
 
1537 1537
 			$subscription = [
1538 1538
 				'id'           => $row['id'],
@@ -1541,10 +1541,10 @@  discard block
 block discarded – undo
1541 1541
 				'source'       => $row['source'],
1542 1542
 				'lastmodified' => $row['lastmodified'],
1543 1543
 
1544
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1544
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1545 1545
 			];
1546 1546
 
1547
-			foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1547
+			foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1548 1548
 				if (!is_null($row[$dbName])) {
1549 1549
 					$subscription[$xmlName] = $row[$dbName];
1550 1550
 				}
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
 
1584 1584
 		$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
1585 1585
 
1586
-		foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1586
+		foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1587 1587
 			if (array_key_exists($xmlName, $properties)) {
1588 1588
 					$values[$dbName] = $properties[$xmlName];
1589 1589
 					if (in_array($dbName, $propertiesBoolean)) {
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 
1635 1635
 			$newValues = [];
1636 1636
 
1637
-			foreach($mutations as $propertyName=>$propertyValue) {
1637
+			foreach ($mutations as $propertyName=>$propertyValue) {
1638 1638
 				if ($propertyName === '{http://calendarserver.org/ns/}source') {
1639 1639
 					$newValues['source'] = $propertyValue->getHref();
1640 1640
 				} else {
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 			$query = $this->db->getQueryBuilder();
1647 1647
 			$query->update('calendarsubscriptions')
1648 1648
 				->set('lastmodified', $query->createNamedParameter(time()));
1649
-			foreach($newValues as $fieldName=>$value) {
1649
+			foreach ($newValues as $fieldName=>$value) {
1650 1650
 				$query->set($fieldName, $query->createNamedParameter($value));
1651 1651
 			}
1652 1652
 			$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 
1697 1697
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
1698 1698
 
1699
-		if(!$row) {
1699
+		if (!$row) {
1700 1700
 			return null;
1701 1701
 		}
1702 1702
 
@@ -1704,8 +1704,8 @@  discard block
 block discarded – undo
1704 1704
 				'uri'          => $row['uri'],
1705 1705
 				'calendardata' => $row['calendardata'],
1706 1706
 				'lastmodified' => $row['lastmodified'],
1707
-				'etag'         => '"' . $row['etag'] . '"',
1708
-				'size'         => (int)$row['size'],
1707
+				'etag'         => '"'.$row['etag'].'"',
1708
+				'size'         => (int) $row['size'],
1709 1709
 		];
1710 1710
 	}
1711 1711
 
@@ -1728,13 +1728,13 @@  discard block
 block discarded – undo
1728 1728
 				->execute();
1729 1729
 
1730 1730
 		$result = [];
1731
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
1731
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
1732 1732
 			$result[] = [
1733 1733
 					'calendardata' => $row['calendardata'],
1734 1734
 					'uri'          => $row['uri'],
1735 1735
 					'lastmodified' => $row['lastmodified'],
1736
-					'etag'         => '"' . $row['etag'] . '"',
1737
-					'size'         => (int)$row['size'],
1736
+					'etag'         => '"'.$row['etag'].'"',
1737
+					'size'         => (int) $row['size'],
1738 1738
 			];
1739 1739
 		}
1740 1740
 
@@ -1826,10 +1826,10 @@  discard block
 block discarded – undo
1826 1826
 		$lastOccurrence = null;
1827 1827
 		$uid = null;
1828 1828
 		$classification = self::CLASSIFICATION_PUBLIC;
1829
-		foreach($vObject->getComponents() as $component) {
1830
-			if ($component->name!=='VTIMEZONE') {
1829
+		foreach ($vObject->getComponents() as $component) {
1830
+			if ($component->name !== 'VTIMEZONE') {
1831 1831
 				$componentType = $component->name;
1832
-				$uid = (string)$component->UID;
1832
+				$uid = (string) $component->UID;
1833 1833
 				break;
1834 1834
 			}
1835 1835
 		}
@@ -1854,13 +1854,13 @@  discard block
 block discarded – undo
1854 1854
 					$lastOccurrence = $firstOccurrence;
1855 1855
 				}
1856 1856
 			} else {
1857
-				$it = new EventIterator($vObject, (string)$component->UID);
1857
+				$it = new EventIterator($vObject, (string) $component->UID);
1858 1858
 				$maxDate = new \DateTime(self::MAX_DATE);
1859 1859
 				if ($it->isInfinite()) {
1860 1860
 					$lastOccurrence = $maxDate->getTimestamp();
1861 1861
 				} else {
1862 1862
 					$end = $it->getDtEnd();
1863
-					while($it->valid() && $end < $maxDate) {
1863
+					while ($it->valid() && $end < $maxDate) {
1864 1864
 						$end = $it->getDtEnd();
1865 1865
 						$it->next();
1866 1866
 
@@ -2100,10 +2100,10 @@  discard block
 block discarded – undo
2100 2100
 		$result->closeCursor();
2101 2101
 
2102 2102
 		if (!isset($objectIds['id'])) {
2103
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2103
+			throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri);
2104 2104
 		}
2105 2105
 
2106
-		return (int)$objectIds['id'];
2106
+		return (int) $objectIds['id'];
2107 2107
 	}
2108 2108
 
2109 2109
 	private function convertPrincipal($principalUri, $toV2) {
@@ -2118,8 +2118,8 @@  discard block
 block discarded – undo
2118 2118
 	}
2119 2119
 
2120 2120
 	private function addOwnerPrincipal(&$calendarInfo) {
2121
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2122
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2121
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
2122
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
2123 2123
 		if (isset($calendarInfo[$ownerPrincipalKey])) {
2124 2124
 			$uri = $calendarInfo[$ownerPrincipalKey];
2125 2125
 		} else {
Please login to merge, or discard this patch.