@@ -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 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | ); |
272 | 272 | |
273 | 273 | $vEvent->DTEND['VALUE'] = 'DATE'; |
274 | - $vEvent->{'UID'} = $doc->UID . $postfix; |
|
274 | + $vEvent->{'UID'} = $doc->UID.$postfix; |
|
275 | 275 | $vEvent->{'RRULE'} = 'FREQ=YEARLY'; |
276 | 276 | $vEvent->{'SUMMARY'} = $summary; |
277 | 277 | $vEvent->{'TRANSP'} = 'TRANSPARENT'; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); |
298 | 298 | $calendarObjects = $this->calDavBackEnd->getCalendarObjects($calendar['id'], CalDavBackend::CALENDAR_TYPE_CALENDAR); |
299 | 299 | |
300 | - foreach($calendarObjects as $calendarObject) { |
|
300 | + foreach ($calendarObjects as $calendarObject) { |
|
301 | 301 | $this->calDavBackEnd->deleteCalendarObject($calendar['id'], $calendarObject['uri'], CalDavBackend::CALENDAR_TYPE_CALENDAR); |
302 | 302 | } |
303 | 303 | } |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | $principal = 'principals/users/'.$user; |
311 | 311 | $this->ensureCalendarExists($principal); |
312 | 312 | $books = $this->cardDavBackEnd->getAddressBooksForUser($principal); |
313 | - foreach($books as $book) { |
|
313 | + foreach ($books as $book) { |
|
314 | 314 | $cards = $this->cardDavBackEnd->getCards($book['id']); |
315 | - foreach($cards as $card) { |
|
315 | + foreach ($cards as $card) { |
|
316 | 316 | $this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']); |
317 | 317 | } |
318 | 318 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | array $book, |
372 | 372 | int $calendarId, |
373 | 373 | array $type):void { |
374 | - $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics'; |
|
374 | + $objectUri = $book['uri'].'-'.$cardUri.$type['postfix'].'.ics'; |
|
375 | 375 | $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix']); |
376 | 376 | $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri); |
377 | 377 | if (is_null($calendarData)) { |
@@ -426,53 +426,53 @@ discard block |
||
426 | 426 | */ |
427 | 427 | private function formatTitle(string $field, |
428 | 428 | string $name, |
429 | - int $year=null, |
|
430 | - bool $supports4Byte=true):string { |
|
429 | + int $year = null, |
|
430 | + bool $supports4Byte = true):string { |
|
431 | 431 | if ($supports4Byte) { |
432 | 432 | switch ($field) { |
433 | 433 | case 'BDAY': |
434 | 434 | return implode('', [ |
435 | 435 | ' |