@@ -143,8 +143,7 @@ |
||
143 | 143 | 'auth' => [$this->user, $this->password, $this->authtype], |
144 | 144 | 'timeout' => $this->timeout |
145 | 145 | ]); |
146 | - } |
|
147 | - catch (ClientException $ex){ |
|
146 | + } catch (ClientException $ex){ |
|
148 | 147 | switch($ex->getCode()){ |
149 | 148 | case 401: |
150 | 149 | throw new UserUnAuthorizedException(); |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | * @param Request $http_request |
140 | 140 | * @return mixed|\Psr\Http\Message\ResponseInterface |
141 | 141 | */ |
142 | - private function makeRequest(Request $http_request){ |
|
143 | - try{ |
|
142 | + private function makeRequest(Request $http_request) { |
|
143 | + try { |
|
144 | 144 | return $this->client->send($http_request, [ |
145 | 145 | 'auth' => [$this->user, $this->password, $this->authtype], |
146 | 146 | 'timeout' => $this->timeout |
147 | 147 | ]); |
148 | 148 | } |
149 | - catch (ClientException $ex){ |
|
150 | - switch($ex->getCode()){ |
|
149 | + catch (ClientException $ex) { |
|
150 | + switch ($ex->getCode()) { |
|
151 | 151 | case 401: |
152 | 152 | throw new UserUnAuthorizedException(); |
153 | 153 | break; |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | |
176 | 176 | $res = $http_response->hasHeader(self::DAVHeader); |
177 | 177 | $options = []; |
178 | - if($res){ |
|
178 | + if ($res) { |
|
179 | 179 | $val = $http_response->getHeaderLine(self::DAVHeader); |
180 | - if(!empty($val)){ |
|
180 | + if (!empty($val)) { |
|
181 | 181 | $options = explode(', ', $val); |
182 | 182 | } |
183 | 183 | } |
@@ -191,14 +191,13 @@ discard block |
||
191 | 191 | public function getUserPrincipal() |
192 | 192 | { |
193 | 193 | $http_response = $this->makeRequest( |
194 | - RequestFactory::createPropFindRequest |
|
195 | - ( |
|
194 | + RequestFactory::createPropFindRequest( |
|
196 | 195 | $this->server_url, |
197 | 196 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent() |
198 | 197 | ) |
199 | 198 | ); |
200 | 199 | |
201 | - return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
200 | + return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
202 | 201 | } |
203 | 202 | |
204 | 203 | /** |
@@ -208,14 +207,13 @@ discard block |
||
208 | 207 | public function getCalendarHome($principal_url) |
209 | 208 | { |
210 | 209 | $http_response = $this->makeRequest( |
211 | - RequestFactory::createPropFindRequest |
|
212 | - ( |
|
210 | + RequestFactory::createPropFindRequest( |
|
213 | 211 | $principal_url, |
214 | 212 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent() |
215 | 213 | ) |
216 | 214 | ); |
217 | 215 | |
218 | - return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
216 | + return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
219 | 217 | } |
220 | 218 | |
221 | 219 | /** |
@@ -229,10 +227,9 @@ discard block |
||
229 | 227 | $uid = $vo->getUID(); |
230 | 228 | $resource_name = $vo->getResourceName(); |
231 | 229 | |
232 | - $resource_url = $calendar_home_set . ($resource_name ? $resource_name : $uid); |
|
230 | + $resource_url = $calendar_home_set.($resource_name ? $resource_name : $uid); |
|
233 | 231 | $http_response = $this->makeRequest( |
234 | - RequestFactory::createMakeCalendarRequest |
|
235 | - ( |
|
232 | + RequestFactory::createMakeCalendarRequest( |
|
236 | 233 | $resource_url, |
237 | 234 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent() |
238 | 235 | ) |
@@ -248,14 +245,13 @@ discard block |
||
248 | 245 | public function getCalendars($calendar_home_set_url) |
249 | 246 | { |
250 | 247 | $http_response = $this->makeRequest( |
251 | - RequestFactory::createPropFindRequest |
|
252 | - ( |
|
248 | + RequestFactory::createPropFindRequest( |
|
253 | 249 | $calendar_home_set_url, |
254 | 250 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent() |
255 | 251 | ) |
256 | 252 | ); |
257 | 253 | |
258 | - return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
254 | + return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
259 | 255 | } |
260 | 256 | |
261 | 257 | /** |
@@ -266,15 +262,14 @@ discard block |
||
266 | 262 | public function getCalendar($calendar_url, $depth = 0) |
267 | 263 | { |
268 | 264 | $http_response = $this->makeRequest( |
269 | - RequestFactory::createPropFindRequest |
|
270 | - ( |
|
265 | + RequestFactory::createPropFindRequest( |
|
271 | 266 | $calendar_url, |
272 | 267 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(), |
273 | 268 | $depth |
274 | 269 | ) |
275 | 270 | ); |
276 | 271 | |
277 | - return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
272 | + return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
278 | 273 | } |
279 | 274 | |
280 | 275 | |
@@ -287,14 +282,13 @@ discard block |
||
287 | 282 | { |
288 | 283 | |
289 | 284 | $http_response = $this->makeRequest( |
290 | - RequestFactory::createReportRequest |
|
291 | - ( |
|
285 | + RequestFactory::createReportRequest( |
|
292 | 286 | $calendar_url, |
293 | 287 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent() |
294 | 288 | ) |
295 | 289 | ); |
296 | 290 | |
297 | - return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
291 | + return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
298 | 292 | } |
299 | 293 | |
300 | 294 | /** |
@@ -307,19 +301,17 @@ discard block |
||
307 | 301 | $uid = $vo->getUID(); |
308 | 302 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
309 | 303 | $http_response = $this->makeRequest( |
310 | - RequestFactory::createPutRequest |
|
311 | - ( |
|
304 | + RequestFactory::createPutRequest( |
|
312 | 305 | $resource_url, |
313 | 306 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent() |
314 | 307 | ) |
315 | 308 | ); |
316 | 309 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
317 | - return new EventCreatedResponse |
|
318 | - ( |
|
310 | + return new EventCreatedResponse( |
|
319 | 311 | $uid, |
320 | 312 | $etag, |
321 | 313 | $resource_url, |
322 | - (string)$http_response->getBody(), |
|
314 | + (string) $http_response->getBody(), |
|
323 | 315 | $http_response->getStatusCode() |
324 | 316 | ); |
325 | 317 | } |
@@ -335,20 +327,18 @@ discard block |
||
335 | 327 | $uid = $vo->getUID(); |
336 | 328 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
337 | 329 | $http_response = $this->makeRequest( |
338 | - RequestFactory::createPutRequest |
|
339 | - ( |
|
330 | + RequestFactory::createPutRequest( |
|
340 | 331 | $resource_url, |
341 | 332 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(), |
342 | 333 | $etag |
343 | 334 | ) |
344 | 335 | ); |
345 | 336 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
346 | - return new EventUpdatedResponse |
|
347 | - ( |
|
337 | + return new EventUpdatedResponse( |
|
348 | 338 | $uid, |
349 | 339 | $etag, |
350 | 340 | $resource_url, |
351 | - (string)$http_response->getBody(), |
|
341 | + (string) $http_response->getBody(), |
|
352 | 342 | $http_response->getStatusCode() |
353 | 343 | ); |
354 | 344 | } |
@@ -362,16 +352,14 @@ discard block |
||
362 | 352 | public function deleteEvent($calendar_url, $uid, $etag = null) |
363 | 353 | { |
364 | 354 | $http_response = $this->makeRequest( |
365 | - RequestFactory::createDeleteRequest |
|
366 | - ( |
|
355 | + RequestFactory::createDeleteRequest( |
|
367 | 356 | $calendar_url.$uid.self::SchedulingInformationSuffix, |
368 | 357 | $etag |
369 | 358 | ) |
370 | 359 | ); |
371 | 360 | |
372 | - return new EventDeletedResponse |
|
373 | - ( |
|
374 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
361 | + return new EventDeletedResponse( |
|
362 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
375 | 363 | ); |
376 | 364 | } |
377 | 365 | |
@@ -379,15 +367,14 @@ discard block |
||
379 | 367 | * @param string $event_url |
380 | 368 | * @return string |
381 | 369 | */ |
382 | - public function getEventVCardBy($event_url){ |
|
370 | + public function getEventVCardBy($event_url) { |
|
383 | 371 | $http_response = $this->makeRequest( |
384 | - RequestFactory::createGetRequest |
|
385 | - ( |
|
372 | + RequestFactory::createGetRequest( |
|
386 | 373 | $event_url |
387 | 374 | ) |
388 | 375 | ); |
389 | 376 | |
390 | - $ical = (string)$http_response->getBody(); |
|
377 | + $ical = (string) $http_response->getBody(); |
|
391 | 378 | return $ical; |
392 | 379 | } |
393 | 380 | |
@@ -399,17 +386,15 @@ discard block |
||
399 | 386 | public function getEventsBy($calendar_url, array $events_urls) |
400 | 387 | { |
401 | 388 | $http_response = $this->makeRequest( |
402 | - RequestFactory::createReportRequest |
|
403 | - ( |
|
389 | + RequestFactory::createReportRequest( |
|
404 | 390 | $calendar_url, |
405 | 391 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent() |
406 | 392 | ) |
407 | 393 | ); |
408 | 394 | |
409 | - return new ResourceCollectionResponse |
|
410 | - ( |
|
395 | + return new ResourceCollectionResponse( |
|
411 | 396 | $this->server_url, |
412 | - (string)$http_response->getBody(), |
|
397 | + (string) $http_response->getBody(), |
|
413 | 398 | $http_response->getStatusCode() |
414 | 399 | ); |
415 | 400 | } |
@@ -423,17 +408,15 @@ discard block |
||
423 | 408 | { |
424 | 409 | |
425 | 410 | $http_response = $this->makeRequest( |
426 | - RequestFactory::createReportRequest |
|
427 | - ( |
|
411 | + RequestFactory::createReportRequest( |
|
428 | 412 | $calendar_url, |
429 | 413 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent() |
430 | 414 | ) |
431 | 415 | ); |
432 | 416 | |
433 | - return new ResourceCollectionResponse |
|
434 | - ( |
|
417 | + return new ResourceCollectionResponse( |
|
435 | 418 | $this->server_url, |
436 | - (string)$http_response->getBody(), |
|
419 | + (string) $http_response->getBody(), |
|
437 | 420 | $http_response->getStatusCode() |
438 | 421 | ); |
439 | 422 | } |
@@ -446,16 +429,14 @@ discard block |
||
446 | 429 | public function deleteCalendar($calendar_url, $etag = null) |
447 | 430 | { |
448 | 431 | $http_response = $this->makeRequest( |
449 | - RequestFactory::createDeleteRequest |
|
450 | - ( |
|
432 | + RequestFactory::createDeleteRequest( |
|
451 | 433 | $calendar_url, |
452 | 434 | $etag |
453 | 435 | ) |
454 | 436 | ); |
455 | 437 | |
456 | - return new CalendarDeletedResponse |
|
457 | - ( |
|
458 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
438 | + return new CalendarDeletedResponse( |
|
439 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
459 | 440 | ); |
460 | 441 | } |
461 | 442 | } |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $filter = []; |
59 | 59 | $props = []; |
60 | 60 | |
61 | - if($this->filter->useGetETags()){ |
|
61 | + if ($this->filter->useGetETags()) { |
|
62 | 62 | $props['{DAV:}getetag'] = ''; |
63 | 63 | } |
64 | 64 | |
65 | - if($this->filter->useGetCalendarData()){ |
|
65 | + if ($this->filter->useGetCalendarData()) { |
|
66 | 66 | $props['{urn:ietf:params:xml:ns:caldav}calendar-data'] = ''; |
67 | 67 | } |
68 | 68 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ]; |
90 | 90 | } |
91 | 91 | |
92 | - $nodes = [ |
|
92 | + $nodes = [ |
|
93 | 93 | '{DAV:}prop' => [ |
94 | 94 | $props |
95 | 95 | ], |
@@ -37,8 +37,8 @@ |
||
37 | 37 | ]; |
38 | 38 | |
39 | 39 | $elements = []; |
40 | - foreach( $this->properties as $val ) { |
|
41 | - $elements[] = [ $val => "" ]; |
|
40 | + foreach ($this->properties as $val) { |
|
41 | + $elements[] = [$val => ""]; |
|
42 | 42 | } |
43 | 43 | return $service->write('{DAV:}propfind', |
44 | 44 | [ |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * @return string |
23 | 23 | */ |
24 | 24 | public function getPrincipalUrl() { |
25 | - return isset($this->found_props['current-user-principal']) && isset($this->found_props['current-user-principal']['href']) ? |
|
25 | + return isset($this->found_props['current-user-principal']) && isset($this->found_props['current-user-principal']['href']) ? |
|
26 | 26 | $this->server_url.$this->found_props['current-user-principal']['href'] : null; |
27 | 27 | } |
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | * @param string|null $body |
43 | 43 | * @param int $code |
44 | 44 | */ |
45 | - public function __construct($server_url = null, $body = null, $code = HttpResponse::HttpCodeOk ) |
|
45 | + public function __construct($server_url = null, $body = null, $code = HttpResponse::HttpCodeOk) |
|
46 | 46 | { |
47 | 47 | parent::__construct($body, $code); |
48 | 48 | $this->server_url = $server_url; |
49 | - if(!empty($this->body)) { |
|
49 | + if (!empty($this->body)) { |
|
50 | 50 | $this->stripped = $this->stripNamespacesFromTags($this->body); |
51 | - $this->xml = simplexml_load_string($this->stripped); |
|
52 | - if($this->xml === FALSE) |
|
51 | + $this->xml = simplexml_load_string($this->stripped); |
|
52 | + if ($this->xml === FALSE) |
|
53 | 53 | throw new XMLResponseParseException(); |
54 | 54 | $this->content = $this->toAssocArray($this->xml); |
55 | 55 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | } |
63 | 63 | |
64 | - protected function setContent($content){ |
|
64 | + protected function setContent($content) { |
|
65 | 65 | $this->content = $content; |
66 | 66 | } |
67 | 67 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | $nameSpaceDefRegEx = '(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']?'; |
95 | 95 | |
96 | 96 | // Cycle through each namespace and remove it from the XML string |
97 | - foreach( $toRemove as $remove ) { |
|
97 | + foreach ($toRemove as $remove) { |
|
98 | 98 | // First remove the namespace from the opening of the tag |
99 | - $xml = str_replace('<' . $remove . ':', '<', $xml); |
|
99 | + $xml = str_replace('<'.$remove.':', '<', $xml); |
|
100 | 100 | // Now remove the namespace from the closing of the tag |
101 | - $xml = str_replace('</' . $remove . ':', '</', $xml); |
|
101 | + $xml = str_replace('</'.$remove.':', '</', $xml); |
|
102 | 102 | // This XML uses the name space with CommentText, so remove that too |
103 | - $xml = str_replace($remove . ':commentText', 'commentText', $xml); |
|
103 | + $xml = str_replace($remove.':commentText', 'commentText', $xml); |
|
104 | 104 | // Complete the pattern for RegEx to remove this namespace declaration |
105 | 105 | $pattern = "/xmlns:{$remove}{$nameSpaceDefRegEx}/"; |
106 | 106 | // Remove the actual namespace declaration using the Pattern |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @return bool |
126 | 126 | */ |
127 | - protected function isValid(){ |
|
127 | + protected function isValid() { |
|
128 | 128 | return isset($this->content['response']); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | \ No newline at end of file |
@@ -49,8 +49,9 @@ |
||
49 | 49 | if(!empty($this->body)) { |
50 | 50 | $this->stripped = $this->stripNamespacesFromTags($this->body); |
51 | 51 | $this->xml = simplexml_load_string($this->stripped); |
52 | - if($this->xml === FALSE) |
|
53 | - throw new XMLResponseParseException(); |
|
52 | + if($this->xml === FALSE) { |
|
53 | + throw new XMLResponseParseException(); |
|
54 | + } |
|
54 | 55 | $this->content = $this->toAssocArray($this->xml); |
55 | 56 | |
56 | 57 | $this->parse(); |
@@ -22,24 +22,24 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @return string|null |
24 | 24 | */ |
25 | - public function getSyncToken(){ |
|
26 | - return isset($this->content['sync-token'])? $this->content['sync-token'] : null; |
|
25 | + public function getSyncToken() { |
|
26 | + return isset($this->content['sync-token']) ? $this->content['sync-token'] : null; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @return bool |
31 | 31 | */ |
32 | - public function hasAvailableChanges(){ |
|
32 | + public function hasAvailableChanges() { |
|
33 | 33 | return count($this->responses) > 0; |
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @return ETagEntityResponse[] |
38 | 38 | */ |
39 | - public function getUpdates(){ |
|
39 | + public function getUpdates() { |
|
40 | 40 | $res = []; |
41 | - foreach ($this->responses as $entity){ |
|
42 | - if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpOKStatus) continue; |
|
41 | + foreach ($this->responses as $entity) { |
|
42 | + if ($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpOKStatus) continue; |
|
43 | 43 | $res[] = $entity; |
44 | 44 | } |
45 | 45 | return $res; |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @return ETagEntityResponse[] |
50 | 50 | */ |
51 | - public function getDeletes(){ |
|
51 | + public function getDeletes() { |
|
52 | 52 | $res = []; |
53 | - foreach ($this->responses as $entity){ |
|
54 | - if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue; |
|
53 | + foreach ($this->responses as $entity) { |
|
54 | + if ($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue; |
|
55 | 55 | $res[] = $entity; |
56 | 56 | } |
57 | 57 | return $res; |
@@ -39,7 +39,9 @@ discard block |
||
39 | 39 | public function getUpdates(){ |
40 | 40 | $res = []; |
41 | 41 | foreach ($this->responses as $entity){ |
42 | - if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpOKStatus) continue; |
|
42 | + if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpOKStatus) { |
|
43 | + continue; |
|
44 | + } |
|
43 | 45 | $res[] = $entity; |
44 | 46 | } |
45 | 47 | return $res; |
@@ -51,7 +53,9 @@ discard block |
||
51 | 53 | public function getDeletes(){ |
52 | 54 | $res = []; |
53 | 55 | foreach ($this->responses as $entity){ |
54 | - if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue; |
|
56 | + if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpNotFoundStatus) { |
|
57 | + continue; |
|
58 | + } |
|
55 | 59 | $res[] = $entity; |
56 | 60 | } |
57 | 61 | return $res; |
@@ -46,14 +46,14 @@ |
||
46 | 46 | * @param DateTime $from |
47 | 47 | * @param DateTime $to |
48 | 48 | */ |
49 | - public function __construct($get_etags = true, $get_calendar_data = false, DateTime $from = null, DateTime $to = null) |
|
49 | + public function __construct($get_etags = true, $get_calendar_data = false, DateTime $from = null, DateTime $to = null) |
|
50 | 50 | { |
51 | 51 | $this->get_etags = $get_etags; |
52 | 52 | $this->get_calendar_data = $get_calendar_data; |
53 | 53 | $this->from = $from; |
54 | 54 | $this->to = $to; |
55 | 55 | |
56 | - if(!is_null($this->from) && !is_null($this->to) && $this->from > $this->to) |
|
56 | + if (!is_null($this->from) && !is_null($this->to) && $this->from > $this->to) |
|
57 | 57 | throw new \InvalidArgumentException("from should be lower than to param"); |
58 | 58 | } |
59 | 59 |
@@ -53,8 +53,9 @@ |
||
53 | 53 | $this->from = $from; |
54 | 54 | $this->to = $to; |
55 | 55 | |
56 | - if(!is_null($this->from) && !is_null($this->to) && $this->from > $this->to) |
|
57 | - throw new \InvalidArgumentException("from should be lower than to param"); |
|
56 | + if(!is_null($this->from) && !is_null($this->to) && $this->from > $this->to) { |
|
57 | + throw new \InvalidArgumentException("from should be lower than to param"); |
|
58 | + } |
|
58 | 59 | } |
59 | 60 | |
60 | 61 | /** |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @return string |
24 | 24 | */ |
25 | - public function getDisplayName(){ |
|
25 | + public function getDisplayName() { |
|
26 | 26 | return isset($this->found_props['displayname']) ? $this->found_props['displayname'] : null; |
27 | 27 | } |
28 | 28 | |
29 | - public function getResourceType(){ |
|
29 | + public function getResourceType() { |
|
30 | 30 | return isset($this->found_props['resourcetype']) ? $this->found_props['resourcetype'] : null; |
31 | 31 | } |
32 | 32 | |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | * @see https://tools.ietf.org/html/rfc6578 |
35 | 35 | * @return string |
36 | 36 | */ |
37 | - public function getSyncToken(){ |
|
37 | + public function getSyncToken() { |
|
38 | 38 | return isset($this->found_props['sync-token']) ? $this->found_props['sync-token'] : null; |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function getCTag(){ |
|
44 | + public function getCTag() { |
|
45 | 45 | return isset($this->found_props['getctag']) ? $this->found_props['getctag'] : null; |
46 | 46 | } |
47 | 47 |
@@ -30,13 +30,13 @@ |
||
30 | 30 | * @param string $type |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - public function getResponseByType($type){ |
|
33 | + public function getResponseByType($type) { |
|
34 | 34 | $responses = []; |
35 | 35 | |
36 | - foreach ($this->getResponses() as $response){ |
|
37 | - if(!$response instanceof GetCalendarResponse) continue; |
|
36 | + foreach ($this->getResponses() as $response) { |
|
37 | + if (!$response instanceof GetCalendarResponse) continue; |
|
38 | 38 | $resource_types = $response->getResourceType(); |
39 | - if(in_array($type, array_keys($resource_types))) $responses[] = $response; |
|
39 | + if (in_array($type, array_keys($resource_types))) $responses[] = $response; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | return $responses; |
@@ -34,9 +34,13 @@ |
||
34 | 34 | $responses = []; |
35 | 35 | |
36 | 36 | foreach ($this->getResponses() as $response){ |
37 | - if(!$response instanceof GetCalendarResponse) continue; |
|
37 | + if(!$response instanceof GetCalendarResponse) { |
|
38 | + continue; |
|
39 | + } |
|
38 | 40 | $resource_types = $response->getResourceType(); |
39 | - if(in_array($type, array_keys($resource_types))) $responses[] = $response; |
|
41 | + if(in_array($type, array_keys($resource_types))) { |
|
42 | + $responses[] = $response; |
|
43 | + } |
|
40 | 44 | } |
41 | 45 | |
42 | 46 | return $responses; |