Passed
Push — master ( 6725ad...8514a2 )
by Roeland
10:48 queued 14s
created
apps/dav/lib/CalDAV/Reminder/ReminderService.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	public function processReminders():void {
107 107
 		$reminders = $this->backend->getRemindersToProcess();
108 108
 
109
-		foreach($reminders as $reminder) {
109
+		foreach ($reminders as $reminder) {
110 110
 			$vcalendar = $this->parseCalendarData($reminder['calendardata']);
111 111
 			if (!$vcalendar) {
112 112
 				$this->backend->removeReminder($reminder['id']);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 			return;
155 155
 		}
156 156
 
157
-		switch($action) {
157
+		switch ($action) {
158 158
 			case '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject':
159 159
 				$this->onCalendarObjectCreate($objectData);
160 160
 				break;
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 		$now = $this->timeFactory->getDateTime();
194 194
 		$isRecurring = $masterItem ? $this->isRecurring($masterItem) : false;
195 195
 
196
-		foreach($recurrenceExceptions as $recurrenceException) {
196
+		foreach ($recurrenceExceptions as $recurrenceException) {
197 197
 			$eventHash = $this->getEventHash($recurrenceException);
198 198
 
199 199
 			if (!isset($recurrenceException->VALARM)) {
200 200
 				continue;
201 201
 			}
202 202
 
203
-			foreach($recurrenceException->VALARM as $valarm) {
203
+			foreach ($recurrenceException->VALARM as $valarm) {
204 204
 				/** @var VAlarm $valarm */
205 205
 				$alarmHash = $this->getAlarmHash($valarm);
206 206
 				$triggerTime = $valarm->getEffectiveTriggerTime();
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				return;
225 225
 			}
226 226
 
227
-			foreach($masterItem->VALARM as $valarm) {
227
+			foreach ($masterItem->VALARM as $valarm) {
228 228
 				$masterAlarms[] = $this->getAlarmHash($valarm);
229 229
 			}
230 230
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 				return;
238 238
 			}
239 239
 
240
-			while($iterator->valid() && count($processedAlarms) < count($masterAlarms)) {
240
+			while ($iterator->valid() && count($processedAlarms) < count($masterAlarms)) {
241 241
 				$event = $iterator->getEventObject();
242 242
 
243 243
 				// Recurrence-exceptions are handled separately, so just ignore them here
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 					continue;
247 247
 				}
248 248
 
249
-				foreach($event->VALARM as $valarm) {
249
+				foreach ($event->VALARM as $valarm) {
250 250
 					/** @var VAlarm $valarm */
251 251
 					$alarmHash = $this->getAlarmHash($valarm);
252 252
 					if (\in_array($alarmHash, $processedAlarms, true)) {
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	private function getRemindersForVAlarm(VAlarm $valarm,
318 318
 										   array $objectData,
319
-										   string $eventHash=null,
320
-										   string $alarmHash=null,
321
-										   bool $isRecurring=false,
322
-										   bool $isRecurrenceException=false):array {
319
+										   string $eventHash = null,
320
+										   string $alarmHash = null,
321
+										   bool $isRecurring = false,
322
+										   bool $isRecurrenceException = false):array {
323 323
 		if ($eventHash === null) {
324 324
 			$eventHash = $this->getEventHash($valarm->parent);
325 325
 		}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		];
353 353
 
354 354
 		$repeat = isset($valarm->REPEAT) ? (int) $valarm->REPEAT->getValue() : 0;
355
-		for($i = 0; $i < $repeat; $i++) {
355
+		for ($i = 0; $i < $repeat; $i++) {
356 356
 			if ($valarm->DURATION === null) {
357 357
 				continue;
358 358
 			}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @param array $reminders
382 382
 	 */
383 383
 	private function writeRemindersToDatabase(array $reminders): void {
384
-		foreach($reminders as $reminder) {
384
+		foreach ($reminders as $reminder) {
385 385
 			$this->backend->insertReminder(
386 386
 				(int) $reminder['calendar_id'],
387 387
 				(int) $reminder['object_id'],
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			return;
428 428
 		}
429 429
 
430
-		while($iterator->valid()) {
430
+		while ($iterator->valid()) {
431 431
 			$event = $iterator->getEventObject();
432 432
 
433 433
 			// Recurrence-exceptions are handled separately, so just ignore them here
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 				continue;
443 443
 			}
444 444
 
445
-			foreach($event->VALARM as $valarm) {
445
+			foreach ($event->VALARM as $valarm) {
446 446
 				/** @var VAlarm $valarm */
447 447
 				$alarmHash = $this->getAlarmHash($valarm);
448 448
 				if ($alarmHash !== $reminder['alarm_hash']) {
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	 */
584 584
 	private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar,
585 585
 											 int $recurrenceId,
586
-											 bool $isRecurrenceException):?VEvent {
586
+											 bool $isRecurrenceException): ?VEvent {
587 587
 		$vevents = $this->getAllVEventsFromVCalendar($vcalendar);
588 588
 		if (count($vevents) === 0) {
589 589
 			return null;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 
596 596
 		// Handle recurrence-exceptions first, because recurrence-expansion is expensive
597 597
 		if ($isRecurrenceException) {
598
-			foreach($recurrenceExceptions as $recurrenceException) {
598
+			foreach ($recurrenceExceptions as $recurrenceException) {
599 599
 				if ($this->getEffectiveRecurrenceIdOfVEvent($recurrenceException) === $recurrenceId) {
600 600
 					return $recurrenceException;
601 601
 				}
@@ -661,11 +661,11 @@  discard block
 block discarded – undo
661 661
 	 * @param string $calendarData
662 662
 	 * @return VObject\Component\VCalendar|null
663 663
 	 */
664
-	private function parseCalendarData(string $calendarData):?VObject\Component\VCalendar {
664
+	private function parseCalendarData(string $calendarData): ?VObject\Component\VCalendar {
665 665
 		try {
666 666
 			return VObject\Reader::read($calendarData,
667 667
 				VObject\Reader::OPTION_FORGIVING);
668
-		} catch(ParseException $ex) {
668
+		} catch (ParseException $ex) {
669 669
 			return null;
670 670
 		}
671 671
 	}
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @param string $principalUri
675 675
 	 * @return IUser|null
676 676
 	 */
677
-	private function getUserFromPrincipalURI(string $principalUri):?IUser {
677
+	private function getUserFromPrincipalURI(string $principalUri): ?IUser {
678 678
 		if (!$principalUri) {
679 679
 			return null;
680 680
 		}
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	private function getAllVEventsFromVCalendar(VObject\Component\VCalendar $vcalendar):array {
695 695
 		$vevents = [];
696 696
 
697
-		foreach($vcalendar->children() as $child) {
697
+		foreach ($vcalendar->children() as $child) {
698 698
 			if (!($child instanceof VObject\Component)) {
699 699
 				continue;
700 700
 			}
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	 * @param array $vevents
724 724
 	 * @return VEvent|null
725 725
 	 */
726
-	private function getMasterItemFromListOfVEvents(array $vevents):?VEvent {
726
+	private function getMasterItemFromListOfVEvents(array $vevents): ?VEvent {
727 727
 		$elements = array_values(array_filter($vevents, function(VEvent $vevent) {
728 728
 			return $vevent->{'RECURRENCE-ID'} === null;
729 729
 		}));
Please login to merge, or discard this patch.