@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => ['timezone', 'string'], |
151 | 151 | '{http://apple.com/ns/ical/}calendar-order' => ['calendarorder', 'int'], |
152 | 152 | '{http://apple.com/ns/ical/}calendar-color' => ['calendarcolor', 'string'], |
153 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => ['deleted_at', 'int'], |
|
153 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => ['deleted_at', 'int'], |
|
154 | 154 | ]; |
155 | 155 | |
156 | 156 | /** |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | $result = $query->executeQuery(); |
249 | - $column = (int)$result->fetchOne(); |
|
249 | + $column = (int) $result->fetchOne(); |
|
250 | 250 | $result->closeCursor(); |
251 | 251 | return $column; |
252 | 252 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | $result = $query->executeQuery(); |
270 | - $column = (int)$result->fetchOne(); |
|
270 | + $column = (int) $result->fetchOne(); |
|
271 | 271 | $result->closeCursor(); |
272 | 272 | return $column; |
273 | 273 | } |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | $calendars = []; |
286 | 286 | while (($row = $result->fetch()) !== false) { |
287 | 287 | $calendars[] = [ |
288 | - 'id' => (int)$row['id'], |
|
289 | - 'deleted_at' => (int)$row['deleted_at'], |
|
288 | + 'id' => (int) $row['id'], |
|
289 | + 'deleted_at' => (int) $row['deleted_at'], |
|
290 | 290 | ]; |
291 | 291 | } |
292 | 292 | $result->closeCursor(); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return array |
320 | 320 | */ |
321 | 321 | public function getCalendarsForUser($principalUri) { |
322 | - return $this->atomic(function () use ($principalUri) { |
|
322 | + return $this->atomic(function() use ($principalUri) { |
|
323 | 323 | $principalUriOriginal = $principalUri; |
324 | 324 | $principalUri = $this->convertPrincipal($principalUri, true); |
325 | 325 | $fields = array_column($this->propertyMap, 0); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | $calendars = []; |
348 | 348 | while ($row = $result->fetch()) { |
349 | - $row['principaluri'] = (string)$row['principaluri']; |
|
349 | + $row['principaluri'] = (string) $row['principaluri']; |
|
350 | 350 | $components = []; |
351 | 351 | if ($row['components']) { |
352 | 352 | $components = explode(',', $row['components']); |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | 'id' => $row['id'], |
357 | 357 | 'uri' => $row['uri'], |
358 | 358 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
359 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
359 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
360 | 360 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
361 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
362 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
363 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
361 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
362 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
363 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
364 | 364 | ]; |
365 | 365 | |
366 | 366 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | $principals[] = $principalUri; |
380 | 380 | |
381 | 381 | $fields = array_column($this->propertyMap, 0); |
382 | - $fields = array_map(function (string $field) { |
|
383 | - return 'a.' . $field; |
|
382 | + $fields = array_map(function(string $field) { |
|
383 | + return 'a.'.$field; |
|
384 | 384 | }, $fields); |
385 | 385 | $fields[] = 'a.id'; |
386 | 386 | $fields[] = 'a.uri'; |
@@ -407,14 +407,14 @@ discard block |
||
407 | 407 | |
408 | 408 | $results = $select->executeQuery(); |
409 | 409 | |
410 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
410 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
411 | 411 | while ($row = $results->fetch()) { |
412 | - $row['principaluri'] = (string)$row['principaluri']; |
|
412 | + $row['principaluri'] = (string) $row['principaluri']; |
|
413 | 413 | if ($row['principaluri'] === $principalUri) { |
414 | 414 | continue; |
415 | 415 | } |
416 | 416 | |
417 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
417 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
418 | 418 | if (isset($calendars[$row['id']])) { |
419 | 419 | if ($readOnly) { |
420 | 420 | // New share can not have more permissions than the old one. |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | } |
429 | 429 | |
430 | 430 | [, $name] = Uri\split($row['principaluri']); |
431 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
432 | - $row['displayname'] = $row['displayname'] . ' (' . ($this->userManager->getDisplayName($name) ?? ($name ?? '')) . ')'; |
|
431 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
432 | + $row['displayname'] = $row['displayname'].' ('.($this->userManager->getDisplayName($name) ?? ($name ?? '')).')'; |
|
433 | 433 | $components = []; |
434 | 434 | if ($row['components']) { |
435 | 435 | $components = explode(',', $row['components']); |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | 'id' => $row['id'], |
439 | 439 | 'uri' => $uri, |
440 | 440 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
441 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
441 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
442 | 442 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
443 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
444 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
445 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
443 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
444 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
445 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
446 | 446 | $readOnlyPropertyName => $readOnly, |
447 | 447 | ]; |
448 | 448 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | $stmt = $query->executeQuery(); |
480 | 480 | $calendars = []; |
481 | 481 | while ($row = $stmt->fetch()) { |
482 | - $row['principaluri'] = (string)$row['principaluri']; |
|
482 | + $row['principaluri'] = (string) $row['principaluri']; |
|
483 | 483 | $components = []; |
484 | 484 | if ($row['components']) { |
485 | 485 | $components = explode(',', $row['components']); |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | 'id' => $row['id'], |
489 | 489 | 'uri' => $row['uri'], |
490 | 490 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
491 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
491 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
492 | 492 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
493 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
494 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
493 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
494 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
495 | 495 | ]; |
496 | 496 | |
497 | 497 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -529,9 +529,9 @@ discard block |
||
529 | 529 | ->executeQuery(); |
530 | 530 | |
531 | 531 | while ($row = $result->fetch()) { |
532 | - $row['principaluri'] = (string)$row['principaluri']; |
|
532 | + $row['principaluri'] = (string) $row['principaluri']; |
|
533 | 533 | [, $name] = Uri\split($row['principaluri']); |
534 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
534 | + $row['displayname'] = $row['displayname']."($name)"; |
|
535 | 535 | $components = []; |
536 | 536 | if ($row['components']) { |
537 | 537 | $components = explode(',', $row['components']); |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | 'id' => $row['id'], |
541 | 541 | 'uri' => $row['publicuri'], |
542 | 542 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
543 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
543 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
544 | 544 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
545 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
546 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
547 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
548 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true, |
|
549 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
545 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
546 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
547 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
548 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => true, |
|
549 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
550 | 550 | ]; |
551 | 551 | |
552 | 552 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -591,12 +591,12 @@ discard block |
||
591 | 591 | $result->closeCursor(); |
592 | 592 | |
593 | 593 | if ($row === false) { |
594 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
594 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
595 | 595 | } |
596 | 596 | |
597 | - $row['principaluri'] = (string)$row['principaluri']; |
|
597 | + $row['principaluri'] = (string) $row['principaluri']; |
|
598 | 598 | [, $name] = Uri\split($row['principaluri']); |
599 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
599 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
600 | 600 | $components = []; |
601 | 601 | if ($row['components']) { |
602 | 602 | $components = explode(',', $row['components']); |
@@ -605,13 +605,13 @@ discard block |
||
605 | 605 | 'id' => $row['id'], |
606 | 606 | 'uri' => $row['publicuri'], |
607 | 607 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
608 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
608 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
609 | 609 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
610 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
611 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
612 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
613 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => true, |
|
614 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
610 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
611 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
612 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
613 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => true, |
|
614 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
615 | 615 | ]; |
616 | 616 | |
617 | 617 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | return null; |
650 | 650 | } |
651 | 651 | |
652 | - $row['principaluri'] = (string)$row['principaluri']; |
|
652 | + $row['principaluri'] = (string) $row['principaluri']; |
|
653 | 653 | $components = []; |
654 | 654 | if ($row['components']) { |
655 | 655 | $components = explode(',', $row['components']); |
@@ -659,10 +659,10 @@ discard block |
||
659 | 659 | 'id' => $row['id'], |
660 | 660 | 'uri' => $row['uri'], |
661 | 661 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
662 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
662 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
663 | 663 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
664 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
665 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
664 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
665 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
666 | 666 | ]; |
667 | 667 | |
668 | 668 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | return null; |
699 | 699 | } |
700 | 700 | |
701 | - $row['principaluri'] = (string)$row['principaluri']; |
|
701 | + $row['principaluri'] = (string) $row['principaluri']; |
|
702 | 702 | $components = []; |
703 | 703 | if ($row['components']) { |
704 | 704 | $components = explode(',', $row['components']); |
@@ -708,10 +708,10 @@ discard block |
||
708 | 708 | 'id' => $row['id'], |
709 | 709 | 'uri' => $row['uri'], |
710 | 710 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
711 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ?: '0'), |
|
711 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'), |
|
712 | 712 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?? 0, |
713 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
714 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
713 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
714 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
715 | 715 | ]; |
716 | 716 | |
717 | 717 | $calendar = $this->rowToCalendar($row, $calendar); |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | return null; |
747 | 747 | } |
748 | 748 | |
749 | - $row['principaluri'] = (string)$row['principaluri']; |
|
749 | + $row['principaluri'] = (string) $row['principaluri']; |
|
750 | 750 | $subscription = [ |
751 | 751 | 'id' => $row['id'], |
752 | 752 | 'uri' => $row['uri'], |
753 | 753 | 'principaluri' => $row['principaluri'], |
754 | 754 | 'source' => $row['source'], |
755 | 755 | 'lastmodified' => $row['lastmodified'], |
756 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
756 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
757 | 757 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
758 | 758 | ]; |
759 | 759 | |
@@ -783,14 +783,14 @@ discard block |
||
783 | 783 | return null; |
784 | 784 | } |
785 | 785 | |
786 | - $row['principaluri'] = (string)$row['principaluri']; |
|
786 | + $row['principaluri'] = (string) $row['principaluri']; |
|
787 | 787 | $subscription = [ |
788 | 788 | 'id' => $row['id'], |
789 | 789 | 'uri' => $row['uri'], |
790 | 790 | 'principaluri' => $row['principaluri'], |
791 | 791 | 'source' => $row['source'], |
792 | 792 | 'lastmodified' => $row['lastmodified'], |
793 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
793 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
794 | 794 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
795 | 795 | ]; |
796 | 796 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
829 | 829 | if (isset($properties[$sccs])) { |
830 | 830 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
831 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
831 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
832 | 832 | } |
833 | 833 | $values['components'] = implode(',', $properties[$sccs]->getValue()); |
834 | 834 | } elseif (isset($properties['components'])) { |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | $values['components'] = $properties['components']; |
838 | 838 | } |
839 | 839 | |
840 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
840 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
841 | 841 | if (isset($properties[$transp])) { |
842 | - $values['transparent'] = (int)($properties[$transp]->getValue() === 'transparent'); |
|
842 | + $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | foreach ($this->propertyMap as $xmlName => [$dbName, $type]) { |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | } |
849 | 849 | } |
850 | 850 | |
851 | - [$calendarId, $calendarData] = $this->atomic(function () use ($values) { |
|
851 | + [$calendarId, $calendarData] = $this->atomic(function() use ($values) { |
|
852 | 852 | $query = $this->db->getQueryBuilder(); |
853 | 853 | $query->insert('calendars'); |
854 | 854 | foreach ($values as $column => $value) { |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | return [$calendarId, $calendarData]; |
862 | 862 | }, $this->db); |
863 | 863 | |
864 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
864 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
865 | 865 | |
866 | 866 | return $calendarId; |
867 | 867 | } |
@@ -884,15 +884,15 @@ discard block |
||
884 | 884 | */ |
885 | 885 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
886 | 886 | $supportedProperties = array_keys($this->propertyMap); |
887 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
887 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
888 | 888 | |
889 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
889 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
890 | 890 | $newValues = []; |
891 | 891 | foreach ($mutations as $propertyName => $propertyValue) { |
892 | 892 | switch ($propertyName) { |
893 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
893 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
894 | 894 | $fieldName = 'transparent'; |
895 | - $newValues[$fieldName] = (int)($propertyValue->getValue() === 'transparent'); |
|
895 | + $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
|
896 | 896 | break; |
897 | 897 | default: |
898 | 898 | $fieldName = $this->propertyMap[$propertyName][0]; |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | break; |
901 | 901 | } |
902 | 902 | } |
903 | - [$calendarData, $shares] = $this->atomic(function () use ($calendarId, $newValues) { |
|
903 | + [$calendarData, $shares] = $this->atomic(function() use ($calendarId, $newValues) { |
|
904 | 904 | $query = $this->db->getQueryBuilder(); |
905 | 905 | $query->update('calendars'); |
906 | 906 | foreach ($newValues as $fieldName => $value) { |
@@ -929,9 +929,9 @@ discard block |
||
929 | 929 | * @return void |
930 | 930 | */ |
931 | 931 | public function deleteCalendar($calendarId, bool $forceDeletePermanently = false) { |
932 | - $this->publishStatusCache->remove((string)$calendarId); |
|
932 | + $this->publishStatusCache->remove((string) $calendarId); |
|
933 | 933 | |
934 | - $this->atomic(function () use ($calendarId, $forceDeletePermanently): void { |
|
934 | + $this->atomic(function() use ($calendarId, $forceDeletePermanently): void { |
|
935 | 935 | // The calendar is deleted right away if this is either enforced by the caller |
936 | 936 | // or the special contacts birthday calendar or when the preference of an empty |
937 | 937 | // retention (0 seconds) is set, which signals a disabled trashbin. |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | public function restoreCalendar(int $id): void { |
997 | - $this->atomic(function () use ($id): void { |
|
997 | + $this->atomic(function() use ($id): void { |
|
998 | 998 | $qb = $this->db->getQueryBuilder(); |
999 | 999 | $update = $qb->update('calendars') |
1000 | 1000 | ->set('deleted_at', $qb->createNamedParameter(null)) |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | */ |
1069 | 1069 | public function getLimitedCalendarObjects(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
1070 | 1070 | $query = $this->db->getQueryBuilder(); |
1071 | - $query->select(['id','uid', 'etag', 'uri', 'calendardata']) |
|
1071 | + $query->select(['id', 'uid', 'etag', 'uri', 'calendardata']) |
|
1072 | 1072 | ->from('calendarobjects') |
1073 | 1073 | ->where($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId))) |
1074 | 1074 | ->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType))) |
@@ -1146,11 +1146,11 @@ discard block |
||
1146 | 1146 | 'id' => $row['id'], |
1147 | 1147 | 'uri' => $row['uri'], |
1148 | 1148 | 'lastmodified' => $row['lastmodified'], |
1149 | - 'etag' => '"' . $row['etag'] . '"', |
|
1149 | + 'etag' => '"'.$row['etag'].'"', |
|
1150 | 1150 | 'calendarid' => $row['calendarid'], |
1151 | - 'size' => (int)$row['size'], |
|
1151 | + 'size' => (int) $row['size'], |
|
1152 | 1152 | 'component' => strtolower($row['componenttype']), |
1153 | - 'classification' => (int)$row['classification'] |
|
1153 | + 'classification' => (int) $row['classification'] |
|
1154 | 1154 | ]; |
1155 | 1155 | } |
1156 | 1156 | $stmt->closeCursor(); |
@@ -1173,13 +1173,13 @@ discard block |
||
1173 | 1173 | 'id' => $row['id'], |
1174 | 1174 | 'uri' => $row['uri'], |
1175 | 1175 | 'lastmodified' => $row['lastmodified'], |
1176 | - 'etag' => '"' . $row['etag'] . '"', |
|
1177 | - 'calendarid' => (int)$row['calendarid'], |
|
1178 | - 'calendartype' => (int)$row['calendartype'], |
|
1179 | - 'size' => (int)$row['size'], |
|
1176 | + 'etag' => '"'.$row['etag'].'"', |
|
1177 | + 'calendarid' => (int) $row['calendarid'], |
|
1178 | + 'calendartype' => (int) $row['calendartype'], |
|
1179 | + 'size' => (int) $row['size'], |
|
1180 | 1180 | 'component' => strtolower($row['componenttype']), |
1181 | - 'classification' => (int)$row['classification'], |
|
1182 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
1181 | + 'classification' => (int) $row['classification'], |
|
1182 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
1183 | 1183 | ]; |
1184 | 1184 | } |
1185 | 1185 | $stmt->closeCursor(); |
@@ -1212,13 +1212,13 @@ discard block |
||
1212 | 1212 | 'id' => $row['id'], |
1213 | 1213 | 'uri' => $row['uri'], |
1214 | 1214 | 'lastmodified' => $row['lastmodified'], |
1215 | - 'etag' => '"' . $row['etag'] . '"', |
|
1215 | + 'etag' => '"'.$row['etag'].'"', |
|
1216 | 1216 | 'calendarid' => $row['calendarid'], |
1217 | 1217 | 'calendaruri' => $row['calendaruri'], |
1218 | - 'size' => (int)$row['size'], |
|
1218 | + 'size' => (int) $row['size'], |
|
1219 | 1219 | 'component' => strtolower($row['componenttype']), |
1220 | - 'classification' => (int)$row['classification'], |
|
1221 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
1220 | + 'classification' => (int) $row['classification'], |
|
1221 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
1222 | 1222 | ]; |
1223 | 1223 | } |
1224 | 1224 | $stmt->closeCursor(); |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | * @return array|null |
1245 | 1245 | */ |
1246 | 1246 | public function getCalendarObject($calendarId, $objectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
1247 | - $key = $calendarId . '::' . $objectUri . '::' . $calendarType; |
|
1247 | + $key = $calendarId.'::'.$objectUri.'::'.$calendarType; |
|
1248 | 1248 | if (isset($this->cachedObjects[$key])) { |
1249 | 1249 | return $this->cachedObjects[$key]; |
1250 | 1250 | } |
@@ -1273,13 +1273,13 @@ discard block |
||
1273 | 1273 | 'uri' => $row['uri'], |
1274 | 1274 | 'uid' => $row['uid'], |
1275 | 1275 | 'lastmodified' => $row['lastmodified'], |
1276 | - 'etag' => '"' . $row['etag'] . '"', |
|
1276 | + 'etag' => '"'.$row['etag'].'"', |
|
1277 | 1277 | 'calendarid' => $row['calendarid'], |
1278 | - 'size' => (int)$row['size'], |
|
1278 | + 'size' => (int) $row['size'], |
|
1279 | 1279 | 'calendardata' => $this->readBlob($row['calendardata']), |
1280 | 1280 | 'component' => strtolower($row['componenttype']), |
1281 | - 'classification' => (int)$row['classification'], |
|
1282 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int)$row['deleted_at'], |
|
1281 | + 'classification' => (int) $row['classification'], |
|
1282 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}deleted-at' => $row['deleted_at'] === null ? $row['deleted_at'] : (int) $row['deleted_at'], |
|
1283 | 1283 | ]; |
1284 | 1284 | } |
1285 | 1285 | |
@@ -1321,12 +1321,12 @@ discard block |
||
1321 | 1321 | 'id' => $row['id'], |
1322 | 1322 | 'uri' => $row['uri'], |
1323 | 1323 | 'lastmodified' => $row['lastmodified'], |
1324 | - 'etag' => '"' . $row['etag'] . '"', |
|
1324 | + 'etag' => '"'.$row['etag'].'"', |
|
1325 | 1325 | 'calendarid' => $row['calendarid'], |
1326 | - 'size' => (int)$row['size'], |
|
1326 | + 'size' => (int) $row['size'], |
|
1327 | 1327 | 'calendardata' => $this->readBlob($row['calendardata']), |
1328 | 1328 | 'component' => strtolower($row['componenttype']), |
1329 | - 'classification' => (int)$row['classification'] |
|
1329 | + 'classification' => (int) $row['classification'] |
|
1330 | 1330 | ]; |
1331 | 1331 | } |
1332 | 1332 | $result->closeCursor(); |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | $this->cachedObjects = []; |
1359 | 1359 | $extraData = $this->getDenormalizedData($calendarData); |
1360 | 1360 | |
1361 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1361 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1362 | 1362 | // Try to detect duplicates |
1363 | 1363 | $qb = $this->db->getQueryBuilder(); |
1364 | 1364 | $qb->select($qb->func()->count('*')) |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | ->andWhere($qb->expr()->eq('calendartype', $qb->createNamedParameter($calendarType))) |
1369 | 1369 | ->andWhere($qb->expr()->isNull('deleted_at')); |
1370 | 1370 | $result = $qb->executeQuery(); |
1371 | - $count = (int)$result->fetchOne(); |
|
1371 | + $count = (int) $result->fetchOne(); |
|
1372 | 1372 | $result->closeCursor(); |
1373 | 1373 | |
1374 | 1374 | if ($count !== 0) { |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | // TODO: implement custom event for federated calendars |
1429 | 1429 | } |
1430 | 1430 | |
1431 | - return '"' . $extraData['etag'] . '"'; |
|
1431 | + return '"'.$extraData['etag'].'"'; |
|
1432 | 1432 | }, $this->db); |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | $this->cachedObjects = []; |
1456 | 1456 | $extraData = $this->getDenormalizedData($calendarData); |
1457 | 1457 | |
1458 | - return $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1458 | + return $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $extraData, $calendarType) { |
|
1459 | 1459 | $query = $this->db->getQueryBuilder(); |
1460 | 1460 | $query->update('calendarobjects') |
1461 | 1461 | ->set('calendardata', $query->createNamedParameter($calendarData, IQueryBuilder::PARAM_LOB)) |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | } |
1492 | 1492 | } |
1493 | 1493 | |
1494 | - return '"' . $extraData['etag'] . '"'; |
|
1494 | + return '"'.$extraData['etag'].'"'; |
|
1495 | 1495 | }, $this->db); |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | */ |
1510 | 1510 | public function moveCalendarObject(string $sourcePrincipalUri, int $sourceObjectId, string $targetPrincipalUri, int $targetCalendarId, string $tragetObjectUri, int $calendarType = self::CALENDAR_TYPE_CALENDAR): bool { |
1511 | 1511 | $this->cachedObjects = []; |
1512 | - return $this->atomic(function () use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
1512 | + return $this->atomic(function() use ($sourcePrincipalUri, $sourceObjectId, $targetPrincipalUri, $targetCalendarId, $tragetObjectUri, $calendarType) { |
|
1513 | 1513 | $object = $this->getCalendarObjectById($sourcePrincipalUri, $sourceObjectId); |
1514 | 1514 | if (empty($object)) { |
1515 | 1515 | return false; |
@@ -1566,7 +1566,7 @@ discard block |
||
1566 | 1566 | */ |
1567 | 1567 | public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR, bool $forceDeletePermanently = false) { |
1568 | 1568 | $this->cachedObjects = []; |
1569 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
1569 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarType, $forceDeletePermanently): void { |
|
1570 | 1570 | $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
1571 | 1571 | |
1572 | 1572 | if ($data === null) { |
@@ -1650,8 +1650,8 @@ discard block |
||
1650 | 1650 | */ |
1651 | 1651 | public function restoreCalendarObject(array $objectData): void { |
1652 | 1652 | $this->cachedObjects = []; |
1653 | - $this->atomic(function () use ($objectData): void { |
|
1654 | - $id = (int)$objectData['id']; |
|
1653 | + $this->atomic(function() use ($objectData): void { |
|
1654 | + $id = (int) $objectData['id']; |
|
1655 | 1655 | $restoreUri = str_replace('-deleted.ics', '.ics', $objectData['uri']); |
1656 | 1656 | $targetObject = $this->getCalendarObject( |
1657 | 1657 | $objectData['calendarid'], |
@@ -1681,17 +1681,17 @@ discard block |
||
1681 | 1681 | // Welp, this should possibly not have happened, but let's ignore |
1682 | 1682 | return; |
1683 | 1683 | } |
1684 | - $this->addChanges($row['calendarid'], [$row['uri']], 1, (int)$row['calendartype']); |
|
1684 | + $this->addChanges($row['calendarid'], [$row['uri']], 1, (int) $row['calendartype']); |
|
1685 | 1685 | |
1686 | - $calendarRow = $this->getCalendarById((int)$row['calendarid']); |
|
1686 | + $calendarRow = $this->getCalendarById((int) $row['calendarid']); |
|
1687 | 1687 | if ($calendarRow === null) { |
1688 | 1688 | throw new RuntimeException('Calendar object data that was just written can\'t be read back. Check your database configuration.'); |
1689 | 1689 | } |
1690 | 1690 | $this->dispatcher->dispatchTyped( |
1691 | 1691 | new CalendarObjectRestoredEvent( |
1692 | - (int)$objectData['calendarid'], |
|
1692 | + (int) $objectData['calendarid'], |
|
1693 | 1693 | $calendarRow, |
1694 | - $this->getShares((int)$row['calendarid']), |
|
1694 | + $this->getShares((int) $row['calendarid']), |
|
1695 | 1695 | $row |
1696 | 1696 | ) |
1697 | 1697 | ); |
@@ -1810,19 +1810,19 @@ discard block |
||
1810 | 1810 | try { |
1811 | 1811 | $matches = $this->validateFilterForObject($row, $filters); |
1812 | 1812 | } catch (ParseException $ex) { |
1813 | - $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
1813 | + $this->logger->error('Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
1814 | 1814 | 'app' => 'dav', |
1815 | 1815 | 'exception' => $ex, |
1816 | 1816 | ]); |
1817 | 1817 | continue; |
1818 | 1818 | } catch (InvalidDataException $ex) { |
1819 | - $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:' . $calendarId . ' uri:' . $row['uri'], [ |
|
1819 | + $this->logger->error('Caught invalid data exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$calendarId.' uri:'.$row['uri'], [ |
|
1820 | 1820 | 'app' => 'dav', |
1821 | 1821 | 'exception' => $ex, |
1822 | 1822 | ]); |
1823 | 1823 | continue; |
1824 | 1824 | } catch (MaxInstancesExceededException $ex) { |
1825 | - $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: ' . $row['uri'], [ |
|
1825 | + $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [ |
|
1826 | 1826 | 'app' => 'dav', |
1827 | 1827 | 'exception' => $ex, |
1828 | 1828 | ]); |
@@ -1834,7 +1834,7 @@ discard block |
||
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | $result[] = $row['uri']; |
1837 | - $key = $calendarId . '::' . $row['uri'] . '::' . $calendarType; |
|
1837 | + $key = $calendarId.'::'.$row['uri'].'::'.$calendarType; |
|
1838 | 1838 | $this->cachedObjects[$key] = $this->rowToCalendarObject($row); |
1839 | 1839 | } |
1840 | 1840 | |
@@ -1853,7 +1853,7 @@ discard block |
||
1853 | 1853 | * @return array |
1854 | 1854 | */ |
1855 | 1855 | public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
1856 | - return $this->atomic(function () use ($principalUri, $filters, $limit, $offset) { |
|
1856 | + return $this->atomic(function() use ($principalUri, $filters, $limit, $offset) { |
|
1857 | 1857 | $calendars = $this->getCalendarsForUser($principalUri); |
1858 | 1858 | $ownCalendars = []; |
1859 | 1859 | $sharedCalendars = []; |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | ->andWhere($compExpr) |
1946 | 1946 | ->andWhere($propParamExpr) |
1947 | 1947 | ->andWhere($query->expr()->iLike('i.value', |
1948 | - $query->createNamedParameter('%' . $this->db->escapeLikeParameter($filters['search-term']) . '%'))) |
|
1948 | + $query->createNamedParameter('%'.$this->db->escapeLikeParameter($filters['search-term']).'%'))) |
|
1949 | 1949 | ->andWhere($query->expr()->isNull('deleted_at')); |
1950 | 1950 | |
1951 | 1951 | if ($offset) { |
@@ -1959,7 +1959,7 @@ discard block |
||
1959 | 1959 | |
1960 | 1960 | $result = []; |
1961 | 1961 | while ($row = $stmt->fetch()) { |
1962 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
1962 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
1963 | 1963 | if (!in_array($path, $result)) { |
1964 | 1964 | $result[] = $path; |
1965 | 1965 | } |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | if ($pattern !== '') { |
2030 | 2030 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
2031 | 2031 | $outerQuery->createNamedParameter('%' |
2032 | - . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
2032 | + . $this->db->escapeLikeParameter($pattern).'%'))); |
|
2033 | 2033 | } |
2034 | 2034 | |
2035 | 2035 | $start = null; |
@@ -2081,7 +2081,7 @@ discard block |
||
2081 | 2081 | // For the pagination with hasLimit and hasTimeRange, a stable ordering is helpful. |
2082 | 2082 | $outerQuery->addOrderBy('id'); |
2083 | 2083 | |
2084 | - $offset = (int)$offset; |
|
2084 | + $offset = (int) $offset; |
|
2085 | 2085 | $outerQuery->setFirstResult($offset); |
2086 | 2086 | |
2087 | 2087 | $calendarObjects = []; |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | * |
2103 | 2103 | * 25 rows and 3 retries is entirely arbitrary. |
2104 | 2104 | */ |
2105 | - $maxResults = (int)max($limit, 25); |
|
2105 | + $maxResults = (int) max($limit, 25); |
|
2106 | 2106 | $outerQuery->setMaxResults($maxResults); |
2107 | 2107 | |
2108 | 2108 | for ($attempt = $objectsCount = 0; $attempt < 3 && $objectsCount < $limit; $attempt++) { |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | $calendarObjects = $this->searchCalendarObjects($outerQuery, $start, $end); |
2117 | 2117 | } |
2118 | 2118 | |
2119 | - $calendarObjects = array_map(function ($o) use ($options) { |
|
2119 | + $calendarObjects = array_map(function($o) use ($options) { |
|
2120 | 2120 | $calendarData = Reader::read($o['calendardata']); |
2121 | 2121 | |
2122 | 2122 | // Expand recurrences if an explicit time range is requested |
@@ -2144,16 +2144,16 @@ discard block |
||
2144 | 2144 | 'type' => $o['componenttype'], |
2145 | 2145 | 'uid' => $o['uid'], |
2146 | 2146 | 'uri' => $o['uri'], |
2147 | - 'objects' => array_map(function ($c) { |
|
2147 | + 'objects' => array_map(function($c) { |
|
2148 | 2148 | return $this->transformSearchData($c); |
2149 | 2149 | }, $objects), |
2150 | - 'timezones' => array_map(function ($c) { |
|
2150 | + 'timezones' => array_map(function($c) { |
|
2151 | 2151 | return $this->transformSearchData($c); |
2152 | 2152 | }, $timezones), |
2153 | 2153 | ]; |
2154 | 2154 | }, $calendarObjects); |
2155 | 2155 | |
2156 | - usort($calendarObjects, function (array $a, array $b) { |
|
2156 | + usort($calendarObjects, function(array $a, array $b) { |
|
2157 | 2157 | /** @var DateTimeImmutable $startA */ |
2158 | 2158 | $startA = $a['objects'][0]['DTSTART'][0] ?? new DateTimeImmutable(self::MAX_DATE); |
2159 | 2159 | /** @var DateTimeImmutable $startB */ |
@@ -2198,7 +2198,7 @@ discard block |
||
2198 | 2198 | 'time-range' => null, |
2199 | 2199 | ]); |
2200 | 2200 | } catch (MaxInstancesExceededException $ex) { |
2201 | - $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: ' . $row['uri'], [ |
|
2201 | + $this->logger->warning('Caught max instances exceeded exception for calendar data. This usually indicates too much recurring (more than 3500) event in calendar data. Object uri: '.$row['uri'], [ |
|
2202 | 2202 | 'app' => 'dav', |
2203 | 2203 | 'exception' => $ex, |
2204 | 2204 | ]); |
@@ -2229,7 +2229,7 @@ discard block |
||
2229 | 2229 | /** @var Component[] $subComponents */ |
2230 | 2230 | $subComponents = $comp->getComponents(); |
2231 | 2231 | /** @var Property[] $properties */ |
2232 | - $properties = array_filter($comp->children(), function ($c) { |
|
2232 | + $properties = array_filter($comp->children(), function($c) { |
|
2233 | 2233 | return $c instanceof Property; |
2234 | 2234 | }); |
2235 | 2235 | $validationRules = $comp->getValidationRules(); |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | array $searchParameters, |
2298 | 2298 | array $options = [], |
2299 | 2299 | ): array { |
2300 | - return $this->atomic(function () use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
2300 | + return $this->atomic(function() use ($principalUri, $pattern, $componentTypes, $searchProperties, $searchParameters, $options) { |
|
2301 | 2301 | $escapePattern = !\array_key_exists('escape_like_param', $options) || $options['escape_like_param'] !== false; |
2302 | 2302 | |
2303 | 2303 | $calendarObjectIdQuery = $this->db->getQueryBuilder(); |
@@ -2309,7 +2309,7 @@ discard block |
||
2309 | 2309 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
2310 | 2310 | foreach ($calendars as $calendar) { |
2311 | 2311 | $calendarAnd = $calendarObjectIdQuery->expr()->andX( |
2312 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id'])), |
|
2312 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id'])), |
|
2313 | 2313 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)), |
2314 | 2314 | ); |
2315 | 2315 | |
@@ -2323,7 +2323,7 @@ discard block |
||
2323 | 2323 | } |
2324 | 2324 | foreach ($subscriptions as $subscription) { |
2325 | 2325 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX( |
2326 | - $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id'])), |
|
2326 | + $calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id'])), |
|
2327 | 2327 | $calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)), |
2328 | 2328 | ); |
2329 | 2329 | |
@@ -2372,7 +2372,7 @@ discard block |
||
2372 | 2372 | if (!$escapePattern) { |
2373 | 2373 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
2374 | 2374 | } else { |
2375 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
2375 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
2376 | 2376 | } |
2377 | 2377 | } |
2378 | 2378 | |
@@ -2400,7 +2400,7 @@ discard block |
||
2400 | 2400 | $result = $calendarObjectIdQuery->executeQuery(); |
2401 | 2401 | $matches = []; |
2402 | 2402 | while (($row = $result->fetch()) !== false) { |
2403 | - $matches[] = (int)$row['objectid']; |
|
2403 | + $matches[] = (int) $row['objectid']; |
|
2404 | 2404 | } |
2405 | 2405 | $result->closeCursor(); |
2406 | 2406 | |
@@ -2412,8 +2412,8 @@ discard block |
||
2412 | 2412 | $result = $query->executeQuery(); |
2413 | 2413 | $calendarObjects = []; |
2414 | 2414 | while (($array = $result->fetch()) !== false) { |
2415 | - $array['calendarid'] = (int)$array['calendarid']; |
|
2416 | - $array['calendartype'] = (int)$array['calendartype']; |
|
2415 | + $array['calendarid'] = (int) $array['calendarid']; |
|
2416 | + $array['calendartype'] = (int) $array['calendartype']; |
|
2417 | 2417 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
2418 | 2418 | |
2419 | 2419 | $calendarObjects[] = $array; |
@@ -2459,7 +2459,7 @@ discard block |
||
2459 | 2459 | $row = $stmt->fetch(); |
2460 | 2460 | $stmt->closeCursor(); |
2461 | 2461 | if ($row) { |
2462 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
2462 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
2463 | 2463 | } |
2464 | 2464 | |
2465 | 2465 | return null; |
@@ -2485,14 +2485,14 @@ discard block |
||
2485 | 2485 | 'id' => $row['id'], |
2486 | 2486 | 'uri' => $row['uri'], |
2487 | 2487 | 'lastmodified' => $row['lastmodified'], |
2488 | - 'etag' => '"' . $row['etag'] . '"', |
|
2488 | + 'etag' => '"'.$row['etag'].'"', |
|
2489 | 2489 | 'calendarid' => $row['calendarid'], |
2490 | 2490 | 'calendaruri' => $row['calendaruri'], |
2491 | - 'size' => (int)$row['size'], |
|
2491 | + 'size' => (int) $row['size'], |
|
2492 | 2492 | 'calendardata' => $this->readBlob($row['calendardata']), |
2493 | 2493 | 'component' => strtolower($row['componenttype']), |
2494 | - 'classification' => (int)$row['classification'], |
|
2495 | - 'deleted_at' => isset($row['deleted_at']) ? ((int)$row['deleted_at']) : null, |
|
2494 | + 'classification' => (int) $row['classification'], |
|
2495 | + 'deleted_at' => isset($row['deleted_at']) ? ((int) $row['deleted_at']) : null, |
|
2496 | 2496 | ]; |
2497 | 2497 | } |
2498 | 2498 | |
@@ -2554,9 +2554,9 @@ discard block |
||
2554 | 2554 | * @return ?array |
2555 | 2555 | */ |
2556 | 2556 | public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
2557 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
2557 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
2558 | 2558 | |
2559 | - return $this->atomic(function () use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
2559 | + return $this->atomic(function() use ($calendarId, $syncToken, $syncLevel, $limit, $calendarType, $table) { |
|
2560 | 2560 | // Current synctoken |
2561 | 2561 | $qb = $this->db->getQueryBuilder(); |
2562 | 2562 | $qb->select('synctoken') |
@@ -2607,7 +2607,7 @@ discard block |
||
2607 | 2607 | while ($entry = $stmt->fetch(\PDO::FETCH_NUM)) { |
2608 | 2608 | // assign uri (column 0) to appropriate mutation based on operation (column 1) |
2609 | 2609 | // forced (int) is needed as doctrine with OCI returns the operation field as string not integer |
2610 | - match ((int)$entry[1]) { |
|
2610 | + match ((int) $entry[1]) { |
|
2611 | 2611 | 1 => $result['added'][] = $entry[0], |
2612 | 2612 | 2 => $result['modified'][] = $entry[0], |
2613 | 2613 | 3 => $result['deleted'][] = $entry[0], |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | 'source' => $row['source'], |
2679 | 2679 | 'lastmodified' => $row['lastmodified'], |
2680 | 2680 | |
2681 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2681 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
2682 | 2682 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
2683 | 2683 | ]; |
2684 | 2684 | |
@@ -2722,7 +2722,7 @@ discard block |
||
2722 | 2722 | } |
2723 | 2723 | } |
2724 | 2724 | |
2725 | - [$subscriptionId, $subscriptionRow] = $this->atomic(function () use ($values) { |
|
2725 | + [$subscriptionId, $subscriptionRow] = $this->atomic(function() use ($values) { |
|
2726 | 2726 | $valuesToInsert = []; |
2727 | 2727 | $query = $this->db->getQueryBuilder(); |
2728 | 2728 | foreach (array_keys($values) as $name) { |
@@ -2763,7 +2763,7 @@ discard block |
||
2763 | 2763 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
2764 | 2764 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
2765 | 2765 | |
2766 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
2766 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
2767 | 2767 | $newValues = []; |
2768 | 2768 | |
2769 | 2769 | foreach ($mutations as $propertyName => $propertyValue) { |
@@ -2775,7 +2775,7 @@ discard block |
||
2775 | 2775 | } |
2776 | 2776 | } |
2777 | 2777 | |
2778 | - $subscriptionRow = $this->atomic(function () use ($subscriptionId, $newValues) { |
|
2778 | + $subscriptionRow = $this->atomic(function() use ($subscriptionId, $newValues) { |
|
2779 | 2779 | $query = $this->db->getQueryBuilder(); |
2780 | 2780 | $query->update('calendarsubscriptions') |
2781 | 2781 | ->set('lastmodified', $query->createNamedParameter(time())); |
@@ -2788,7 +2788,7 @@ discard block |
||
2788 | 2788 | return $this->getSubscriptionById($subscriptionId); |
2789 | 2789 | }, $this->db); |
2790 | 2790 | |
2791 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
2791 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
2792 | 2792 | |
2793 | 2793 | return true; |
2794 | 2794 | }); |
@@ -2801,7 +2801,7 @@ discard block |
||
2801 | 2801 | * @return void |
2802 | 2802 | */ |
2803 | 2803 | public function deleteSubscription($subscriptionId) { |
2804 | - $this->atomic(function () use ($subscriptionId): void { |
|
2804 | + $this->atomic(function() use ($subscriptionId): void { |
|
2805 | 2805 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
2806 | 2806 | |
2807 | 2807 | $query = $this->db->getQueryBuilder(); |
@@ -2826,7 +2826,7 @@ discard block |
||
2826 | 2826 | ->executeStatement(); |
2827 | 2827 | |
2828 | 2828 | if ($subscriptionRow) { |
2829 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
2829 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
2830 | 2830 | } |
2831 | 2831 | }, $this->db); |
2832 | 2832 | } |
@@ -2865,8 +2865,8 @@ discard block |
||
2865 | 2865 | 'uri' => $row['uri'], |
2866 | 2866 | 'calendardata' => $row['calendardata'], |
2867 | 2867 | 'lastmodified' => $row['lastmodified'], |
2868 | - 'etag' => '"' . $row['etag'] . '"', |
|
2869 | - 'size' => (int)$row['size'], |
|
2868 | + 'etag' => '"'.$row['etag'].'"', |
|
2869 | + 'size' => (int) $row['size'], |
|
2870 | 2870 | ]; |
2871 | 2871 | } |
2872 | 2872 | |
@@ -2894,8 +2894,8 @@ discard block |
||
2894 | 2894 | 'calendardata' => $row['calendardata'], |
2895 | 2895 | 'uri' => $row['uri'], |
2896 | 2896 | 'lastmodified' => $row['lastmodified'], |
2897 | - 'etag' => '"' . $row['etag'] . '"', |
|
2898 | - 'size' => (int)$row['size'], |
|
2897 | + 'etag' => '"'.$row['etag'].'"', |
|
2898 | + 'size' => (int) $row['size'], |
|
2899 | 2899 | ]; |
2900 | 2900 | } |
2901 | 2901 | $stmt->closeCursor(); |
@@ -2937,8 +2937,8 @@ discard block |
||
2937 | 2937 | if ($count === 0) { |
2938 | 2938 | return; |
2939 | 2939 | } |
2940 | - $ids = array_map(static function (array $id) { |
|
2941 | - return (int)$id[0]; |
|
2940 | + $ids = array_map(static function(array $id) { |
|
2941 | + return (int) $id[0]; |
|
2942 | 2942 | }, $result->fetchAll(\PDO::FETCH_NUM)); |
2943 | 2943 | $result->closeCursor(); |
2944 | 2944 | |
@@ -2991,15 +2991,15 @@ discard block |
||
2991 | 2991 | */ |
2992 | 2992 | protected function addChanges(int $calendarId, array $objectUris, int $operation, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
2993 | 2993 | $this->cachedObjects = []; |
2994 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
2994 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
2995 | 2995 | |
2996 | - $this->atomic(function () use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
2996 | + $this->atomic(function() use ($calendarId, $objectUris, $operation, $calendarType, $table): void { |
|
2997 | 2997 | $query = $this->db->getQueryBuilder(); |
2998 | 2998 | $query->select('synctoken') |
2999 | 2999 | ->from($table) |
3000 | 3000 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
3001 | 3001 | $result = $query->executeQuery(); |
3002 | - $syncToken = (int)$result->fetchOne(); |
|
3002 | + $syncToken = (int) $result->fetchOne(); |
|
3003 | 3003 | $result->closeCursor(); |
3004 | 3004 | |
3005 | 3005 | $query = $this->db->getQueryBuilder(); |
@@ -3028,7 +3028,7 @@ discard block |
||
3028 | 3028 | public function restoreChanges(int $calendarId, int $calendarType = self::CALENDAR_TYPE_CALENDAR): void { |
3029 | 3029 | $this->cachedObjects = []; |
3030 | 3030 | |
3031 | - $this->atomic(function () use ($calendarId, $calendarType): void { |
|
3031 | + $this->atomic(function() use ($calendarId, $calendarType): void { |
|
3032 | 3032 | $qbAdded = $this->db->getQueryBuilder(); |
3033 | 3033 | $qbAdded->select('uri') |
3034 | 3034 | ->from('calendarobjects') |
@@ -3058,7 +3058,7 @@ discard block |
||
3058 | 3058 | ) |
3059 | 3059 | ); |
3060 | 3060 | $resultDeleted = $qbDeleted->executeQuery(); |
3061 | - $deletedUris = array_map(function (string $uri) { |
|
3061 | + $deletedUris = array_map(function(string $uri) { |
|
3062 | 3062 | return str_replace('-deleted.ics', '.ics', $uri); |
3063 | 3063 | }, $resultDeleted->fetchAll(\PDO::FETCH_COLUMN)); |
3064 | 3064 | $resultDeleted->closeCursor(); |
@@ -3103,7 +3103,7 @@ discard block |
||
3103 | 3103 | // Track first component type and uid |
3104 | 3104 | if ($uid === null) { |
3105 | 3105 | $componentType = $component->name; |
3106 | - $uid = (string)$component->UID; |
|
3106 | + $uid = (string) $component->UID; |
|
3107 | 3107 | } |
3108 | 3108 | } |
3109 | 3109 | } |
@@ -3194,11 +3194,11 @@ discard block |
||
3194 | 3194 | * @param list<string> $remove |
3195 | 3195 | */ |
3196 | 3196 | public function updateShares(IShareable $shareable, array $add, array $remove): void { |
3197 | - $this->atomic(function () use ($shareable, $add, $remove): void { |
|
3197 | + $this->atomic(function() use ($shareable, $add, $remove): void { |
|
3198 | 3198 | $calendarId = $shareable->getResourceId(); |
3199 | 3199 | $calendarRow = $this->getCalendarById($calendarId); |
3200 | 3200 | if ($calendarRow === null) { |
3201 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $calendarId); |
|
3201 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$calendarId); |
|
3202 | 3202 | } |
3203 | 3203 | $oldShares = $this->getShares($calendarId); |
3204 | 3204 | |
@@ -3229,7 +3229,7 @@ discard block |
||
3229 | 3229 | * @return string|null |
3230 | 3230 | */ |
3231 | 3231 | public function setPublishStatus($value, $calendar) { |
3232 | - $publishStatus = $this->atomic(function () use ($value, $calendar) { |
|
3232 | + $publishStatus = $this->atomic(function() use ($value, $calendar) { |
|
3233 | 3233 | $calendarId = $calendar->getResourceId(); |
3234 | 3234 | $calendarData = $this->getCalendarById($calendarId); |
3235 | 3235 | |
@@ -3258,7 +3258,7 @@ discard block |
||
3258 | 3258 | return null; |
3259 | 3259 | }, $this->db); |
3260 | 3260 | |
3261 | - $this->publishStatusCache->set((string)$calendar->getResourceId(), $publishStatus ?? false); |
|
3261 | + $this->publishStatusCache->set((string) $calendar->getResourceId(), $publishStatus ?? false); |
|
3262 | 3262 | return $publishStatus; |
3263 | 3263 | } |
3264 | 3264 | |
@@ -3267,7 +3267,7 @@ discard block |
||
3267 | 3267 | * @return string|false |
3268 | 3268 | */ |
3269 | 3269 | public function getPublishStatus($calendar) { |
3270 | - $cached = $this->publishStatusCache->get((string)$calendar->getResourceId()); |
|
3270 | + $cached = $this->publishStatusCache->get((string) $calendar->getResourceId()); |
|
3271 | 3271 | if ($cached !== null) { |
3272 | 3272 | return $cached; |
3273 | 3273 | } |
@@ -3282,7 +3282,7 @@ discard block |
||
3282 | 3282 | $publishStatus = $result->fetchOne(); |
3283 | 3283 | $result->closeCursor(); |
3284 | 3284 | |
3285 | - $this->publishStatusCache->set((string)$calendar->getResourceId(), $publishStatus); |
|
3285 | + $this->publishStatusCache->set((string) $calendar->getResourceId(), $publishStatus); |
|
3286 | 3286 | return $publishStatus; |
3287 | 3287 | } |
3288 | 3288 | |
@@ -3307,14 +3307,14 @@ discard block |
||
3307 | 3307 | |
3308 | 3308 | $hasPublishStatuses = []; |
3309 | 3309 | while ($row = $result->fetch()) { |
3310 | - $this->publishStatusCache->set((string)$row['resourceid'], $row['publicuri']); |
|
3311 | - $hasPublishStatuses[(int)$row['resourceid']] = true; |
|
3310 | + $this->publishStatusCache->set((string) $row['resourceid'], $row['publicuri']); |
|
3311 | + $hasPublishStatuses[(int) $row['resourceid']] = true; |
|
3312 | 3312 | } |
3313 | 3313 | |
3314 | 3314 | // Also remember resources with no publish status |
3315 | 3315 | foreach ($resourceIds as $resourceId) { |
3316 | 3316 | if (!isset($hasPublishStatuses[$resourceId])) { |
3317 | - $this->publishStatusCache->set((string)$resourceId, false); |
|
3317 | + $this->publishStatusCache->set((string) $resourceId, false); |
|
3318 | 3318 | } |
3319 | 3319 | } |
3320 | 3320 | |
@@ -3341,7 +3341,7 @@ discard block |
||
3341 | 3341 | */ |
3342 | 3342 | public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
3343 | 3343 | $this->cachedObjects = []; |
3344 | - $this->atomic(function () use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
3344 | + $this->atomic(function() use ($calendarId, $objectUri, $calendarData, $calendarType): void { |
|
3345 | 3345 | $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
3346 | 3346 | |
3347 | 3347 | try { |
@@ -3413,7 +3413,7 @@ discard block |
||
3413 | 3413 | * deletes all birthday calendars |
3414 | 3414 | */ |
3415 | 3415 | public function deleteAllBirthdayCalendars() { |
3416 | - $this->atomic(function (): void { |
|
3416 | + $this->atomic(function(): void { |
|
3417 | 3417 | $query = $this->db->getQueryBuilder(); |
3418 | 3418 | $result = $query->select(['id'])->from('calendars') |
3419 | 3419 | ->where($query->expr()->eq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))) |
@@ -3433,7 +3433,7 @@ discard block |
||
3433 | 3433 | * @param $subscriptionId |
3434 | 3434 | */ |
3435 | 3435 | public function purgeAllCachedEventsForSubscription($subscriptionId) { |
3436 | - $this->atomic(function () use ($subscriptionId): void { |
|
3436 | + $this->atomic(function() use ($subscriptionId): void { |
|
3437 | 3437 | $query = $this->db->getQueryBuilder(); |
3438 | 3438 | $query->select('uri') |
3439 | 3439 | ->from('calendarobjects') |
@@ -3479,7 +3479,7 @@ discard block |
||
3479 | 3479 | return; |
3480 | 3480 | } |
3481 | 3481 | |
3482 | - $this->atomic(function () use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
3482 | + $this->atomic(function() use ($subscriptionId, $calendarObjectIds, $calendarObjectUris): void { |
|
3483 | 3483 | foreach (array_chunk($calendarObjectIds, 1000) as $chunk) { |
3484 | 3484 | $query = $this->db->getQueryBuilder(); |
3485 | 3485 | $query->delete($this->dbObjectPropertiesTable) |
@@ -3572,10 +3572,10 @@ discard block |
||
3572 | 3572 | $result->closeCursor(); |
3573 | 3573 | |
3574 | 3574 | if (!isset($objectIds['id'])) { |
3575 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
3575 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
3576 | 3576 | } |
3577 | 3577 | |
3578 | - return (int)$objectIds['id']; |
|
3578 | + return (int) $objectIds['id']; |
|
3579 | 3579 | } |
3580 | 3580 | |
3581 | 3581 | /** |
@@ -3591,7 +3591,7 @@ discard block |
||
3591 | 3591 | ->from('calendarchanges'); |
3592 | 3592 | |
3593 | 3593 | $result = $query->executeQuery(); |
3594 | - $maxId = (int)$result->fetchOne(); |
|
3594 | + $maxId = (int) $result->fetchOne(); |
|
3595 | 3595 | $result->closeCursor(); |
3596 | 3596 | if (!$maxId || $maxId < $keep) { |
3597 | 3597 | return 0; |
@@ -3629,8 +3629,8 @@ discard block |
||
3629 | 3629 | * |
3630 | 3630 | */ |
3631 | 3631 | private function addOwnerPrincipalToCalendar(array $calendarInfo): array { |
3632 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
3633 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
3632 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
3633 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
3634 | 3634 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
3635 | 3635 | $uri = $calendarInfo[$ownerPrincipalKey]; |
3636 | 3636 | } else { |
@@ -3739,10 +3739,10 @@ discard block |
||
3739 | 3739 | } |
3740 | 3740 | |
3741 | 3741 | public function unshare(IShareable $shareable, string $principal): void { |
3742 | - $this->atomic(function () use ($shareable, $principal): void { |
|
3742 | + $this->atomic(function() use ($shareable, $principal): void { |
|
3743 | 3743 | $calendarData = $this->getCalendarById($shareable->getResourceId()); |
3744 | 3744 | if ($calendarData === null) { |
3745 | - throw new \RuntimeException('Trying to update shares for non-existing calendar: ' . $shareable->getResourceId()); |
|
3745 | + throw new \RuntimeException('Trying to update shares for non-existing calendar: '.$shareable->getResourceId()); |
|
3746 | 3746 | } |
3747 | 3747 | |
3748 | 3748 | $oldShares = $this->getShares($shareable->getResourceId()); |
@@ -108,17 +108,17 @@ discard block |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | if ($node instanceof Calendar) { |
111 | - $propFind->handle('{' . self::NS_CALENDARSERVER . '}publish-url', function () use ($node) { |
|
111 | + $propFind->handle('{'.self::NS_CALENDARSERVER.'}publish-url', function() use ($node) { |
|
112 | 112 | if ($node->getPublishStatus()) { |
113 | 113 | // We return the publish-url only if the calendar is published. |
114 | 114 | $token = $node->getPublishStatus(); |
115 | - $publishUrl = $this->urlGenerator->getAbsoluteURL($this->server->getBaseUri() . 'public-calendars/') . $token; |
|
115 | + $publishUrl = $this->urlGenerator->getAbsoluteURL($this->server->getBaseUri().'public-calendars/').$token; |
|
116 | 116 | |
117 | 117 | return new Publisher($publishUrl, true); |
118 | 118 | } |
119 | 119 | }); |
120 | 120 | |
121 | - $propFind->handle('{' . self::NS_CALENDARSERVER . '}allowed-sharing-modes', function () use ($node) { |
|
121 | + $propFind->handle('{'.self::NS_CALENDARSERVER.'}allowed-sharing-modes', function() use ($node) { |
|
122 | 122 | $canShare = (!$node->isSubscription() && $node->canWrite()); |
123 | 123 | $canPublish = (!$node->isSubscription() && $node->canWrite()); |
124 | 124 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $path = $request->getPath(); |
145 | 145 | |
146 | 146 | // Only handling xml |
147 | - $contentType = (string)$request->getHeader('Content-Type'); |
|
147 | + $contentType = (string) $request->getHeader('Content-Type'); |
|
148 | 148 | if (!str_contains($contentType, 'application/xml') && !str_contains($contentType, 'text/xml')) { |
149 | 149 | return; |
150 | 150 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | switch ($documentType) { |
173 | 173 | |
174 | - case '{' . self::NS_CALENDARSERVER . '}publish-calendar': |
|
174 | + case '{'.self::NS_CALENDARSERVER.'}publish-calendar': |
|
175 | 175 | |
176 | 176 | // We can only deal with IShareableCalendar objects |
177 | 177 | if (!$node instanceof Calendar) { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | // Breaking the event chain |
207 | 207 | return false; |
208 | 208 | |
209 | - case '{' . self::NS_CALENDARSERVER . '}unpublish-calendar': |
|
209 | + case '{'.self::NS_CALENDARSERVER.'}unpublish-calendar': |
|
210 | 210 | |
211 | 211 | // We can only deal with IShareableCalendar objects |
212 | 212 | if (!$node instanceof Calendar) { |