Completed
Pull Request — master (#3044)
by Thomas
15:53
created
apps/dav/lib/AppInfo/Application.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 		$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
82 82
 
83 83
 		// first time login event setup
84
-		$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
84
+		$dispatcher->addListener(IUser::class.'::firstLogin', function($event) use ($hm) {
85 85
 			if ($event instanceof GenericEvent) {
86 86
 				$hm->firstLogin($event->getSubject());
87 87
 			}
88 88
 		});
89 89
 
90
-		$birthdayListener = function ($event) {
90
+		$birthdayListener = function($event) {
91 91
 			if ($event instanceof GenericEvent) {
92 92
 				/** @var BirthdayService $b */
93 93
 				$b = $this->getContainer()->query(BirthdayService::class);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::createCard', $birthdayListener);
103 103
 		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::updateCard', $birthdayListener);
104
-		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function ($event) {
104
+		$dispatcher->addListener('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', function($event) {
105 105
 			if ($event instanceof GenericEvent) {
106 106
 				/** @var BirthdayService $b */
107 107
 				$b = $this->getContainer()->query(BirthdayService::class);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener);
188 188
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener);
189 189
 
190
-		$reminderListener = function ($event) {
190
+		$reminderListener = function($event) {
191 191
 			if ($event instanceof GenericEvent) {
192 192
 				/** @var ReminderService $m */
193 193
 				$m = $this->getContainer()->query(ReminderService::class);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDAVBackend::createCalendarObject', $reminderListener);
203 203
 		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDAVBackend::updateCalendarObject', $reminderListener);
204
-		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDAVBackend::deleteCalendarObject', function ($event) {
204
+		$dispatcher->addListener('\OCA\DAV\CalDAV\CalDAVBackend::deleteCalendarObject', function($event) {
205 205
 			if ($event instanceof GenericEvent) {
206 206
 				/** @var ReminderService $m */
207 207
 				$m = $this->getContainer()->query(ReminderService::class);
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/CalDavBackend.php 1 patch
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
200 200
 		}
201 201
 
202
-		return (int)$query->execute()->fetchColumn();
202
+		return (int) $query->execute()->fetchColumn();
203 203
 	}
204 204
 
205 205
 	/**
@@ -246,25 +246,25 @@  discard block
 block discarded – undo
246 246
 		$stmt = $query->execute();
247 247
 
248 248
 		$calendars = [];
249
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
249
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
250 250
 
251 251
 			$components = [];
252 252
 			if ($row['components']) {
253
-				$components = explode(',',$row['components']);
253
+				$components = explode(',', $row['components']);
254 254
 			}
255 255
 
256 256
 			$calendar = [
257 257
 				'id' => $row['id'],
258 258
 				'uri' => $row['uri'],
259 259
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
260
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
261
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
262
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
263
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
264
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
260
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
261
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
262
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
263
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
264
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
265 265
 			];
266 266
 
267
-			foreach($this->propertyMap as $xmlName=>$dbName) {
267
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
268 268
 				$calendar[$xmlName] = $row[$dbName];
269 269
 			}
270 270
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$principals = array_map(function($principal) {
283 283
 			return urldecode($principal);
284 284
 		}, $principals);
285
-		$principals[]= $principalUri;
285
+		$principals[] = $principalUri;
286 286
 
287 287
 		$fields = array_values($this->propertyMap);
288 288
 		$fields[] = 'a.id';
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 			->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
303 303
 			->execute();
304 304
 
305
-		$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
306
-		while($row = $result->fetch()) {
305
+		$readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only';
306
+		while ($row = $result->fetch()) {
307 307
 			if ($row['principaluri'] === $principalUri) {
308 308
 				continue;
309 309
 			}
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
 			}
323 323
 
324 324
 			list(, $name) = URLUtil::splitPath($row['principaluri']);
325
-			$uri = $row['uri'] . '_shared_by_' . $name;
326
-			$row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')';
325
+			$uri = $row['uri'].'_shared_by_'.$name;
326
+			$row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')';
327 327
 			$components = [];
328 328
 			if ($row['components']) {
329
-				$components = explode(',',$row['components']);
329
+				$components = explode(',', $row['components']);
330 330
 			}
331 331
 			$calendar = [
332 332
 				'id' => $row['id'],
333 333
 				'uri' => $uri,
334 334
 				'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
335
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
336
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
337
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
338
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
339
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
335
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
336
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
337
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
338
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
339
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
340 340
 				$readOnlyPropertyName => $readOnly,
341 341
 			];
342 342
 
343
-			foreach($this->propertyMap as $xmlName=>$dbName) {
343
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
344 344
 				$calendar[$xmlName] = $row[$dbName];
345 345
 			}
346 346
 
@@ -369,21 +369,21 @@  discard block
 block discarded – undo
369 369
 			->orderBy('calendarorder', 'ASC');
370 370
 		$stmt = $query->execute();
371 371
 		$calendars = [];
372
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
372
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
373 373
 			$components = [];
374 374
 			if ($row['components']) {
375
-				$components = explode(',',$row['components']);
375
+				$components = explode(',', $row['components']);
376 376
 			}
377 377
 			$calendar = [
378 378
 				'id' => $row['id'],
379 379
 				'uri' => $row['uri'],
380 380
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
381
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
382
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
383
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
384
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
381
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
382
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
383
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
384
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
385 385
 			];
386
-			foreach($this->propertyMap as $xmlName=>$dbName) {
386
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
387 387
 				$calendar[$xmlName] = $row[$dbName];
388 388
 			}
389 389
 
@@ -434,27 +434,27 @@  discard block
 block discarded – undo
434 434
 			->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
435 435
 			->execute();
436 436
 
437
-		while($row = $result->fetch()) {
437
+		while ($row = $result->fetch()) {
438 438
 			list(, $name) = URLUtil::splitPath($row['principaluri']);
439
-			$row['displayname'] = $row['displayname'] . "($name)";
439
+			$row['displayname'] = $row['displayname']."($name)";
440 440
 			$components = [];
441 441
 			if ($row['components']) {
442
-				$components = explode(',',$row['components']);
442
+				$components = explode(',', $row['components']);
443 443
 			}
444 444
 			$calendar = [
445 445
 				'id' => $row['id'],
446 446
 				'uri' => $row['publicuri'],
447 447
 				'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
448
-				'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
449
-				'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
450
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
451
-				'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
452
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
453
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
454
-				'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
448
+				'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
449
+				'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
450
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
451
+				'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
452
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint),
453
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
454
+				'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
455 455
 			];
456 456
 
457
-			foreach($this->propertyMap as $xmlName=>$dbName) {
457
+			foreach ($this->propertyMap as $xmlName=>$dbName) {
458 458
 				$calendar[$xmlName] = $row[$dbName];
459 459
 			}
460 460
 
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
 		$result->closeCursor();
499 499
 
500 500
 		if ($row === false) {
501
-			throw new NotFound('Node with name \'' . $uri . '\' could not be found');
501
+			throw new NotFound('Node with name \''.$uri.'\' could not be found');
502 502
 		}
503 503
 
504 504
 		list(, $name) = URLUtil::splitPath($row['principaluri']);
505
-		$row['displayname'] = $row['displayname'] . ' ' . "($name)";
505
+		$row['displayname'] = $row['displayname'].' '."($name)";
506 506
 		$components = [];
507 507
 		if ($row['components']) {
508
-			$components = explode(',',$row['components']);
508
+			$components = explode(',', $row['components']);
509 509
 		}
510 510
 		$calendar = [
511 511
 			'id' => $row['id'],
512 512
 			'uri' => $row['publicuri'],
513 513
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
514
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
515
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
516
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
517
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
518
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
519
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ,
520
-			'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
514
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
515
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
516
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
517
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
518
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
519
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ,
520
+			'{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC,
521 521
 		];
522 522
 
523
-		foreach($this->propertyMap as $xmlName=>$dbName) {
523
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
524 524
 			$calendar[$xmlName] = $row[$dbName];
525 525
 		}
526 526
 
@@ -560,20 +560,20 @@  discard block
 block discarded – undo
560 560
 
561 561
 		$components = [];
562 562
 		if ($row['components']) {
563
-			$components = explode(',',$row['components']);
563
+			$components = explode(',', $row['components']);
564 564
 		}
565 565
 
566 566
 		$calendar = [
567 567
 			'id' => $row['id'],
568 568
 			'uri' => $row['uri'],
569 569
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
570
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
571
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
572
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
573
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
570
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
571
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
572
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
573
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
574 574
 		];
575 575
 
576
-		foreach($this->propertyMap as $xmlName=>$dbName) {
576
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
577 577
 			$calendar[$xmlName] = $row[$dbName];
578 578
 		}
579 579
 
@@ -606,20 +606,20 @@  discard block
 block discarded – undo
606 606
 
607 607
 		$components = [];
608 608
 		if ($row['components']) {
609
-			$components = explode(',',$row['components']);
609
+			$components = explode(',', $row['components']);
610 610
 		}
611 611
 
612 612
 		$calendar = [
613 613
 			'id' => $row['id'],
614 614
 			'uri' => $row['uri'],
615 615
 			'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint),
616
-			'{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
617
-			'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
618
-			'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
619
-			'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
616
+			'{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
617
+			'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
618
+			'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
619
+			'{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
620 620
 		];
621 621
 
622
-		foreach($this->propertyMap as $xmlName=>$dbName) {
622
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
623 623
 			$calendar[$xmlName] = $row[$dbName];
624 624
 		}
625 625
 
@@ -653,16 +653,16 @@  discard block
 block discarded – undo
653 653
 		$sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
654 654
 		if (isset($properties[$sccs])) {
655 655
 			if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) {
656
-				throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
656
+				throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet');
657 657
 			}
658
-			$values['components'] = implode(',',$properties[$sccs]->getValue());
658
+			$values['components'] = implode(',', $properties[$sccs]->getValue());
659 659
 		}
660
-		$transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
660
+		$transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
661 661
 		if (isset($properties[$transp])) {
662 662
 			$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
663 663
 		}
664 664
 
665
-		foreach($this->propertyMap as $xmlName=>$dbName) {
665
+		foreach ($this->propertyMap as $xmlName=>$dbName) {
666 666
 			if (isset($properties[$xmlName])) {
667 667
 				$values[$dbName] = $properties[$xmlName];
668 668
 			}
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 
671 671
 		$query = $this->db->getQueryBuilder();
672 672
 		$query->insert('calendars');
673
-		foreach($values as $column => $value) {
673
+		foreach ($values as $column => $value) {
674 674
 			$query->setValue($column, $query->createNamedParameter($value));
675 675
 		}
676 676
 		$query->execute();
@@ -703,14 +703,14 @@  discard block
 block discarded – undo
703 703
 	 */
704 704
 	function updateCalendar($calendarId, PropPatch $propPatch) {
705 705
 		$supportedProperties = array_keys($this->propertyMap);
706
-		$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
706
+		$supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp';
707 707
 
708 708
 		$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
709 709
 			$newValues = [];
710 710
 			foreach ($mutations as $propertyName => $propertyValue) {
711 711
 
712 712
 				switch ($propertyName) {
713
-					case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' :
713
+					case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' :
714 714
 						$fieldName = 'transparent';
715 715
 						$newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent');
716 716
 						break;
@@ -825,16 +825,16 @@  discard block
 block discarded – undo
825 825
 		$stmt = $query->execute();
826 826
 
827 827
 		$result = [];
828
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
828
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
829 829
 			$result[] = [
830 830
 					'id'           => $row['id'],
831 831
 					'uri'          => $row['uri'],
832 832
 					'lastmodified' => $row['lastmodified'],
833
-					'etag'         => '"' . $row['etag'] . '"',
833
+					'etag'         => '"'.$row['etag'].'"',
834 834
 					'calendarid'   => $row['calendarid'],
835
-					'size'         => (int)$row['size'],
835
+					'size'         => (int) $row['size'],
836 836
 					'component'    => strtolower($row['componenttype']),
837
-					'classification'=> (int)$row['classification']
837
+					'classification'=> (int) $row['classification']
838 838
 			];
839 839
 		}
840 840
 
@@ -867,18 +867,18 @@  discard block
 block discarded – undo
867 867
 		$stmt = $query->execute();
868 868
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
869 869
 
870
-		if(!$row) return null;
870
+		if (!$row) return null;
871 871
 
872 872
 		return [
873 873
 				'id'            => $row['id'],
874 874
 				'uri'           => $row['uri'],
875 875
 				'lastmodified'  => $row['lastmodified'],
876
-				'etag'          => '"' . $row['etag'] . '"',
876
+				'etag'          => '"'.$row['etag'].'"',
877 877
 				'calendarid'    => $row['calendarid'],
878
-				'size'          => (int)$row['size'],
878
+				'size'          => (int) $row['size'],
879 879
 				'calendardata'  => $this->readBlob($row['calendardata']),
880 880
 				'component'     => strtolower($row['componenttype']),
881
-				'classification'=> (int)$row['classification']
881
+				'classification'=> (int) $row['classification']
882 882
 		];
883 883
 	}
884 884
 
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
 					'id'           => $row['id'],
918 918
 					'uri'          => $row['uri'],
919 919
 					'lastmodified' => $row['lastmodified'],
920
-					'etag'         => '"' . $row['etag'] . '"',
920
+					'etag'         => '"'.$row['etag'].'"',
921 921
 					'calendarid'   => $row['calendarid'],
922
-					'size'         => (int)$row['size'],
922
+					'size'         => (int) $row['size'],
923 923
 					'calendardata' => $this->readBlob($row['calendardata']),
924 924
 					'component'    => strtolower($row['componenttype']),
925
-					'classification' => (int)$row['classification']
925
+					'classification' => (int) $row['classification']
926 926
 				];
927 927
 			}
928 928
 			$result->closeCursor();
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 				'objectUri' => $objectUri,
988 988
 				'calendarData' => $calendarData]));
989 989
 
990
-		return '"' . $extraData['etag'] . '"';
990
+		return '"'.$extraData['etag'].'"';
991 991
 	}
992 992
 
993 993
 	/**
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 				'objectUri' => $objectUri,
1048 1048
 				'calendarData' => $calendarData]));
1049 1049
 
1050
-		return '"' . $extraData['etag'] . '"';
1050
+		return '"'.$extraData['etag'].'"';
1051 1051
 	}
1052 1052
 
1053 1053
 	/**
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 		$stmt = $query->execute();
1206 1206
 
1207 1207
 		$result = [];
1208
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1208
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1209 1209
 			if ($requirePostFilter) {
1210 1210
 				if (!$this->validateFilterForObject($row, $filters)) {
1211 1211
 					continue;
@@ -1226,14 +1226,14 @@  discard block
 block discarded – undo
1226 1226
 	 * @param integer|null $offset
1227 1227
 	 * @return array
1228 1228
 	 */
1229
-	public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) {
1229
+	public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) {
1230 1230
 		$calendars = $this->getCalendarsForUser($principalUri);
1231 1231
 		$ownCalendars = [];
1232 1232
 		$sharedCalendars = [];
1233 1233
 
1234 1234
 		$uriMapper = [];
1235 1235
 
1236
-		foreach($calendars as $calendar) {
1236
+		foreach ($calendars as $calendar) {
1237 1237
 			if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
1238 1238
 				$ownCalendars[] = $calendar['id'];
1239 1239
 			} else {
@@ -1248,11 +1248,11 @@  discard block
 block discarded – undo
1248 1248
 		$query = $this->db->getQueryBuilder();
1249 1249
 		// Calendar id expressions
1250 1250
 		$calendarExpressions = [];
1251
-		foreach($ownCalendars as $id) {
1251
+		foreach ($ownCalendars as $id) {
1252 1252
 			$calendarExpressions[] = $query->expr()
1253 1253
 				->eq('c.calendarid', $query->createNamedParameter($id));
1254 1254
 		}
1255
-		foreach($sharedCalendars as $id) {
1255
+		foreach ($sharedCalendars as $id) {
1256 1256
 			$calendarExpressions[] = $query->expr()->andX(
1257 1257
 				$query->expr()->eq('c.calendarid',
1258 1258
 					$query->createNamedParameter($id)),
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 
1270 1270
 		// Component expressions
1271 1271
 		$compExpressions = [];
1272
-		foreach($filters['comps'] as $comp) {
1272
+		foreach ($filters['comps'] as $comp) {
1273 1273
 			$compExpressions[] = $query->expr()
1274 1274
 				->eq('c.componenttype', $query->createNamedParameter($comp));
1275 1275
 		}
@@ -1288,13 +1288,13 @@  discard block
 block discarded – undo
1288 1288
 		}
1289 1289
 
1290 1290
 		$propParamExpressions = [];
1291
-		foreach($filters['props'] as $prop) {
1291
+		foreach ($filters['props'] as $prop) {
1292 1292
 			$propParamExpressions[] = $query->expr()->andX(
1293 1293
 				$query->expr()->eq('i.name', $query->createNamedParameter($prop)),
1294 1294
 				$query->expr()->isNull('i.parameter')
1295 1295
 			);
1296 1296
 		}
1297
-		foreach($filters['params'] as $param) {
1297
+		foreach ($filters['params'] as $param) {
1298 1298
 			$propParamExpressions[] = $query->expr()->andX(
1299 1299
 				$query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
1300 1300
 				$query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
 		$stmt = $query->execute();
1327 1327
 
1328 1328
 		$result = [];
1329
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1330
-			$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
1329
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1330
+			$path = $uriMapper[$row['calendarid']].'/'.$row['uri'];
1331 1331
 			if (!in_array($path, $result)) {
1332 1332
 				$result[] = $path;
1333 1333
 			}
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 		$stmt = $query->execute();
1368 1368
 
1369 1369
 		if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1370
-			return $row['calendaruri'] . '/' . $row['objecturi'];
1370
+			return $row['calendaruri'].'/'.$row['objecturi'];
1371 1371
 		}
1372 1372
 
1373 1373
 		return null;
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 	function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
1433 1433
 		// Current synctoken
1434 1434
 		$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
1435
-		$stmt->execute([ $calendarId ]);
1435
+		$stmt->execute([$calendarId]);
1436 1436
 		$currentToken = $stmt->fetchColumn(0);
1437 1437
 
1438 1438
 		if (is_null($currentToken)) {
@@ -1449,8 +1449,8 @@  discard block
 block discarded – undo
1449 1449
 		if ($syncToken) {
1450 1450
 
1451 1451
 			$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`";
1452
-			if ($limit>0) {
1453
-				$query.= " `LIMIT` " . (int)$limit;
1452
+			if ($limit > 0) {
1453
+				$query .= " `LIMIT` ".(int) $limit;
1454 1454
 			}
1455 1455
 
1456 1456
 			// Fetching all changes
@@ -1461,15 +1461,15 @@  discard block
 block discarded – undo
1461 1461
 
1462 1462
 			// This loop ensures that any duplicates are overwritten, only the
1463 1463
 			// last change on a node is relevant.
1464
-			while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1464
+			while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1465 1465
 
1466 1466
 				$changes[$row['uri']] = $row['operation'];
1467 1467
 
1468 1468
 			}
1469 1469
 
1470
-			foreach($changes as $uri => $operation) {
1470
+			foreach ($changes as $uri => $operation) {
1471 1471
 
1472
-				switch($operation) {
1472
+				switch ($operation) {
1473 1473
 					case 1 :
1474 1474
 						$result['added'][] = $uri;
1475 1475
 						break;
@@ -1539,10 +1539,10 @@  discard block
 block discarded – undo
1539 1539
 			->from('calendarsubscriptions')
1540 1540
 			->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
1541 1541
 			->orderBy('calendarorder', 'asc');
1542
-		$stmt =$query->execute();
1542
+		$stmt = $query->execute();
1543 1543
 
1544 1544
 		$subscriptions = [];
1545
-		while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1545
+		while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
1546 1546
 
1547 1547
 			$subscription = [
1548 1548
 				'id'           => $row['id'],
@@ -1551,10 +1551,10 @@  discard block
 block discarded – undo
1551 1551
 				'source'       => $row['source'],
1552 1552
 				'lastmodified' => $row['lastmodified'],
1553 1553
 
1554
-				'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1554
+				'{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
1555 1555
 			];
1556 1556
 
1557
-			foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1557
+			foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1558 1558
 				if (!is_null($row[$dbName])) {
1559 1559
 					$subscription[$xmlName] = $row[$dbName];
1560 1560
 				}
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 
1594 1594
 		$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
1595 1595
 
1596
-		foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1596
+		foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
1597 1597
 			if (array_key_exists($xmlName, $properties)) {
1598 1598
 					$values[$dbName] = $properties[$xmlName];
1599 1599
 					if (in_array($dbName, $propertiesBoolean)) {
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 
1642 1642
 			$newValues = [];
1643 1643
 
1644
-			foreach($mutations as $propertyName=>$propertyValue) {
1644
+			foreach ($mutations as $propertyName=>$propertyValue) {
1645 1645
 				if ($propertyName === '{http://calendarserver.org/ns/}source') {
1646 1646
 					$newValues['source'] = $propertyValue->getHref();
1647 1647
 				} else {
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 			$query = $this->db->getQueryBuilder();
1654 1654
 			$query->update('calendarsubscriptions')
1655 1655
 				->set('lastmodified', $query->createNamedParameter(time()));
1656
-			foreach($newValues as $fieldName=>$value) {
1656
+			foreach ($newValues as $fieldName=>$value) {
1657 1657
 				$query->set($fieldName, $query->createNamedParameter($value));
1658 1658
 			}
1659 1659
 			$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 
1704 1704
 		$row = $stmt->fetch(\PDO::FETCH_ASSOC);
1705 1705
 
1706
-		if(!$row) {
1706
+		if (!$row) {
1707 1707
 			return null;
1708 1708
 		}
1709 1709
 
@@ -1711,8 +1711,8 @@  discard block
 block discarded – undo
1711 1711
 				'uri'          => $row['uri'],
1712 1712
 				'calendardata' => $row['calendardata'],
1713 1713
 				'lastmodified' => $row['lastmodified'],
1714
-				'etag'         => '"' . $row['etag'] . '"',
1715
-				'size'         => (int)$row['size'],
1714
+				'etag'         => '"'.$row['etag'].'"',
1715
+				'size'         => (int) $row['size'],
1716 1716
 		];
1717 1717
 	}
1718 1718
 
@@ -1735,13 +1735,13 @@  discard block
 block discarded – undo
1735 1735
 				->execute();
1736 1736
 
1737 1737
 		$result = [];
1738
-		foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
1738
+		foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
1739 1739
 			$result[] = [
1740 1740
 					'calendardata' => $row['calendardata'],
1741 1741
 					'uri'          => $row['uri'],
1742 1742
 					'lastmodified' => $row['lastmodified'],
1743
-					'etag'         => '"' . $row['etag'] . '"',
1744
-					'size'         => (int)$row['size'],
1743
+					'etag'         => '"'.$row['etag'].'"',
1744
+					'size'         => (int) $row['size'],
1745 1745
 			];
1746 1746
 		}
1747 1747
 
@@ -1833,10 +1833,10 @@  discard block
 block discarded – undo
1833 1833
 		$lastOccurrence = null;
1834 1834
 		$uid = null;
1835 1835
 		$classification = self::CLASSIFICATION_PUBLIC;
1836
-		foreach($vObject->getComponents() as $component) {
1837
-			if ($component->name!=='VTIMEZONE') {
1836
+		foreach ($vObject->getComponents() as $component) {
1837
+			if ($component->name !== 'VTIMEZONE') {
1838 1838
 				$componentType = $component->name;
1839
-				$uid = (string)$component->UID;
1839
+				$uid = (string) $component->UID;
1840 1840
 				break;
1841 1841
 			}
1842 1842
 		}
@@ -1861,13 +1861,13 @@  discard block
 block discarded – undo
1861 1861
 					$lastOccurrence = $firstOccurrence;
1862 1862
 				}
1863 1863
 			} else {
1864
-				$it = new EventIterator($vObject, (string)$component->UID);
1864
+				$it = new EventIterator($vObject, (string) $component->UID);
1865 1865
 				$maxDate = new \DateTime(self::MAX_DATE);
1866 1866
 				if ($it->isInfinite()) {
1867 1867
 					$lastOccurrence = $maxDate->getTimestamp();
1868 1868
 				} else {
1869 1869
 					$end = $it->getDtEnd();
1870
-					while($it->valid() && $end < $maxDate) {
1870
+					while ($it->valid() && $end < $maxDate) {
1871 1871
 						$end = $it->getDtEnd();
1872 1872
 						$it->next();
1873 1873
 
@@ -2107,10 +2107,10 @@  discard block
 block discarded – undo
2107 2107
 		$result->closeCursor();
2108 2108
 
2109 2109
 		if (!isset($objectIds['id'])) {
2110
-			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2110
+			throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri);
2111 2111
 		}
2112 2112
 
2113
-		return (int)$objectIds['id'];
2113
+		return (int) $objectIds['id'];
2114 2114
 	}
2115 2115
 
2116 2116
 	private function convertPrincipal($principalUri, $toV2) {
@@ -2125,8 +2125,8 @@  discard block
 block discarded – undo
2125 2125
 	}
2126 2126
 
2127 2127
 	private function addOwnerPrincipal(&$calendarInfo) {
2128
-		$ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal';
2129
-		$displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname';
2128
+		$ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal';
2129
+		$displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname';
2130 2130
 		if (isset($calendarInfo[$ownerPrincipalKey])) {
2131 2131
 			$uri = $calendarInfo[$ownerPrincipalKey];
2132 2132
 		} else {
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
 			->execute();
2196 2196
 
2197 2197
 		$reminders = [];
2198
-		while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
2198
+		while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
2199 2199
 			$reminder = [
2200 2200
 				'id' => $row['id'],
2201 2201
 				'calendarId' => $row['calendarId'],
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 
2215 2215
 			if ($shares = $this->getShares($row['calendarId'])) {
2216 2216
 				$key = 'href';
2217
-				$reminder['sharees'] = array_map(function ($item) use ($key) {
2217
+				$reminder['sharees'] = array_map(function($item) use ($key) {
2218 2218
 					return substr($item[$key], 10);
2219 2219
 				}, $shares);
2220 2220
 			}
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/Reminder/Notifier.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 			// Deal with known subjects
50 50
 			case 'calendar_reminder':
51 51
 				$notification->setParsedSubject(
52
-					(string)$l->t('Your event "%s" is in %s', $notification->getSubjectParameters())
52
+					(string) $l->t('Your event "%s" is in %s', $notification->getSubjectParameters())
53 53
 				);
54 54
 
55 55
 				return $notification;
Please login to merge, or discard this patch.