@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $calendar = $this->ensureCalendarExists($principalUri); |
| 149 | 149 | foreach (['', '-death', '-anniversary'] as $tag) { |
| 150 | - $objectUri = $book['uri'] . '-' . $cardUri . $tag .'.ics'; |
|
| 150 | + $objectUri = $book['uri'].'-'.$cardUri.$tag.'.ics'; |
|
| 151 | 151 | $this->calDavBackEnd->deleteCalendarObject($calendar['id'], $objectUri); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @return array|null |
| 159 | 159 | * @throws \Sabre\DAV\Exception\BadRequest |
| 160 | 160 | */ |
| 161 | - public function ensureCalendarExists(string $principal):?array { |
|
| 161 | + public function ensureCalendarExists(string $principal): ?array { |
|
| 162 | 162 | $calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); |
| 163 | 163 | if (!is_null($calendar)) { |
| 164 | 164 | return $calendar; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function buildDateFromContact(string $cardData, |
| 183 | 183 | string $dateField, |
| 184 | - string $postfix):?VCalendar { |
|
| 184 | + string $postfix): ?VCalendar { |
|
| 185 | 185 | if (empty($cardData)) { |
| 186 | 186 | return null; |
| 187 | 187 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | return null; |
| 205 | 205 | } |
| 206 | 206 | $birthday = $doc->{$dateField}; |
| 207 | - if (!(string)$birthday) { |
|
| 207 | + if (!(string) $birthday) { |
|
| 208 | 208 | return null; |
| 209 | 209 | } |
| 210 | 210 | // Skip if the BDAY property is not of the right type. |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $unknownYear = false; |
| 223 | 223 | $originalYear = null; |
| 224 | 224 | if (!$dateParts['year']) { |
| 225 | - $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date']; |
|
| 225 | + $birthday = '1970-'.$dateParts['month'].'-'.$dateParts['date']; |
|
| 226 | 226 | |
| 227 | 227 | $unknownYear = true; |
| 228 | 228 | } else { |
@@ -230,14 +230,14 @@ discard block |
||
| 230 | 230 | if (isset($parameters['X-APPLE-OMIT-YEAR'])) { |
| 231 | 231 | $omitYear = $parameters['X-APPLE-OMIT-YEAR']; |
| 232 | 232 | if ($dateParts['year'] === $omitYear) { |
| 233 | - $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date']; |
|
| 233 | + $birthday = '1970-'.$dateParts['month'].'-'.$dateParts['date']; |
|
| 234 | 234 | $unknownYear = true; |
| 235 | 235 | } |
| 236 | 236 | } else { |
| 237 | - $originalYear = (int)$dateParts['year']; |
|
| 237 | + $originalYear = (int) $dateParts['year']; |
|
| 238 | 238 | |
| 239 | 239 | if ($originalYear < 1970) { |
| 240 | - $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date']; |
|
| 240 | + $birthday = '1970-'.$dateParts['month'].'-'.$dateParts['date']; |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $date |
| 265 | 265 | ); |
| 266 | 266 | $vEvent->DTEND['VALUE'] = 'DATE'; |
| 267 | - $vEvent->{'UID'} = $doc->UID . $postfix; |
|
| 267 | + $vEvent->{'UID'} = $doc->UID.$postfix; |
|
| 268 | 268 | $vEvent->{'RRULE'} = 'FREQ=YEARLY'; |
| 269 | 269 | $vEvent->{'SUMMARY'} = $summary; |
| 270 | 270 | $vEvent->{'TRANSP'} = 'TRANSPARENT'; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); |
| 291 | 291 | $calendarObjects = $this->calDavBackEnd->getCalendarObjects($calendar['id'], CalDavBackend::CALENDAR_TYPE_CALENDAR); |
| 292 | 292 | |
| 293 | - foreach($calendarObjects as $calendarObject) { |
|
| 293 | + foreach ($calendarObjects as $calendarObject) { |
|
| 294 | 294 | $this->calDavBackEnd->deleteCalendarObject($calendar['id'], $calendarObject['uri'], CalDavBackend::CALENDAR_TYPE_CALENDAR); |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | $principal = 'principals/users/'.$user; |
| 304 | 304 | $this->ensureCalendarExists($principal); |
| 305 | 305 | $books = $this->cardDavBackEnd->getAddressBooksForUser($principal); |
| 306 | - foreach($books as $book) { |
|
| 306 | + foreach ($books as $book) { |
|
| 307 | 307 | $cards = $this->cardDavBackEnd->getCards($book['id']); |
| 308 | - foreach($cards as $card) { |
|
| 308 | + foreach ($cards as $card) { |
|
| 309 | 309 | $this->onCardChanged($book['id'], $card['uri'], $card['carddata']); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | array $book, |
| 365 | 365 | int $calendarId, |
| 366 | 366 | array $type):void { |
| 367 | - $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics'; |
|
| 367 | + $objectUri = $book['uri'].'-'.$cardUri.$type['postfix'].'.ics'; |
|
| 368 | 368 | $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix']); |
| 369 | 369 | $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri); |
| 370 | 370 | if (is_null($calendarData)) { |
@@ -419,53 +419,53 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | private function formatTitle(string $field, |
| 421 | 421 | string $name, |
| 422 | - int $year=null, |
|
| 423 | - bool $supports4Byte=true):string { |
|
| 422 | + int $year = null, |
|
| 423 | + bool $supports4Byte = true):string { |
|
| 424 | 424 | if ($supports4Byte) { |
| 425 | 425 | switch ($field) { |
| 426 | 426 | case 'BDAY': |
| 427 | 427 | return implode('', [ |
| 428 | 428 | ' |