@@ -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(); |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | * @return mixed|\Psr\Http\Message\ResponseInterface |
142 | 142 | * @throws \GuzzleHttp\Exception\GuzzleException |
143 | 143 | */ |
144 | - private function makeRequest(Request $http_request){ |
|
145 | - try{ |
|
144 | + private function makeRequest(Request $http_request) { |
|
145 | + try { |
|
146 | 146 | return $this->client->send($http_request, [ |
147 | 147 | 'auth' => [$this->user, $this->password, $this->authtype], |
148 | 148 | 'timeout' => $this->timeout |
149 | 149 | ]); |
150 | 150 | } |
151 | - catch (ClientException $ex){ |
|
152 | - switch($ex->getCode()){ |
|
151 | + catch (ClientException $ex) { |
|
152 | + switch ($ex->getCode()) { |
|
153 | 153 | case 401: |
154 | 154 | throw new UserUnAuthorizedException(); |
155 | 155 | break; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | |
181 | 181 | $res = $http_response->hasHeader(self::DAVHeader); |
182 | 182 | $options = []; |
183 | - if($res){ |
|
183 | + if ($res) { |
|
184 | 184 | $val = $http_response->getHeaderLine(self::DAVHeader); |
185 | - if(!empty($val)){ |
|
185 | + if (!empty($val)) { |
|
186 | 186 | $options = explode(', ', $val); |
187 | 187 | } |
188 | 188 | } |
@@ -196,14 +196,13 @@ discard block |
||
196 | 196 | public function getUserPrincipal() |
197 | 197 | { |
198 | 198 | $http_response = $this->makeRequest( |
199 | - RequestFactory::createPropFindRequest |
|
200 | - ( |
|
199 | + RequestFactory::createPropFindRequest( |
|
201 | 200 | $this->server_url, |
202 | 201 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent() |
203 | 202 | ) |
204 | 203 | ); |
205 | 204 | |
206 | - return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
205 | + return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
207 | 206 | } |
208 | 207 | |
209 | 208 | /** |
@@ -214,14 +213,13 @@ discard block |
||
214 | 213 | public function getCalendarHome($principal_url) |
215 | 214 | { |
216 | 215 | $http_response = $this->makeRequest( |
217 | - RequestFactory::createPropFindRequest |
|
218 | - ( |
|
216 | + RequestFactory::createPropFindRequest( |
|
219 | 217 | $principal_url, |
220 | 218 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent() |
221 | 219 | ) |
222 | 220 | ); |
223 | 221 | |
224 | - return new CalendarHomesMultiResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
222 | + return new CalendarHomesMultiResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
225 | 223 | } |
226 | 224 | |
227 | 225 | /** |
@@ -236,10 +234,9 @@ discard block |
||
236 | 234 | $uid = $vo->getUID(); |
237 | 235 | $resource_name = $vo->getResourceName(); |
238 | 236 | |
239 | - $resource_url = $calendar_home_set . ($resource_name ? $resource_name : $uid); |
|
237 | + $resource_url = $calendar_home_set.($resource_name ? $resource_name : $uid); |
|
240 | 238 | $http_response = $this->makeRequest( |
241 | - RequestFactory::createMakeCalendarRequest |
|
242 | - ( |
|
239 | + RequestFactory::createMakeCalendarRequest( |
|
243 | 240 | $resource_url, |
244 | 241 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent() |
245 | 242 | ) |
@@ -256,14 +253,13 @@ discard block |
||
256 | 253 | public function getCalendars($calendar_home_set_url) |
257 | 254 | { |
258 | 255 | $http_response = $this->makeRequest( |
259 | - RequestFactory::createPropFindRequest |
|
260 | - ( |
|
256 | + RequestFactory::createPropFindRequest( |
|
261 | 257 | $calendar_home_set_url, |
262 | 258 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent() |
263 | 259 | ) |
264 | 260 | ); |
265 | 261 | |
266 | - return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
262 | + return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
267 | 263 | } |
268 | 264 | |
269 | 265 | /** |
@@ -274,15 +270,14 @@ discard block |
||
274 | 270 | public function getCalendar($calendar_url) |
275 | 271 | { |
276 | 272 | $http_response = $this->makeRequest( |
277 | - RequestFactory::createPropFindRequest |
|
278 | - ( |
|
273 | + RequestFactory::createPropFindRequest( |
|
279 | 274 | $calendar_url, |
280 | 275 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(), |
281 | 276 | 0 |
282 | 277 | ) |
283 | 278 | ); |
284 | 279 | |
285 | - return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
280 | + return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
286 | 281 | } |
287 | 282 | |
288 | 283 | |
@@ -296,14 +291,13 @@ discard block |
||
296 | 291 | { |
297 | 292 | |
298 | 293 | $http_response = $this->makeRequest( |
299 | - RequestFactory::createReportRequest |
|
300 | - ( |
|
294 | + RequestFactory::createReportRequest( |
|
301 | 295 | $calendar_url, |
302 | 296 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent() |
303 | 297 | ) |
304 | 298 | ); |
305 | 299 | |
306 | - return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
300 | + return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
307 | 301 | } |
308 | 302 | |
309 | 303 | /** |
@@ -317,19 +311,17 @@ discard block |
||
317 | 311 | $uid = $vo->getUID(); |
318 | 312 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
319 | 313 | $http_response = $this->makeRequest( |
320 | - RequestFactory::createPutRequest |
|
321 | - ( |
|
314 | + RequestFactory::createPutRequest( |
|
322 | 315 | $resource_url, |
323 | 316 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent() |
324 | 317 | ) |
325 | 318 | ); |
326 | 319 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
327 | - return new EventCreatedResponse |
|
328 | - ( |
|
320 | + return new EventCreatedResponse( |
|
329 | 321 | $uid, |
330 | 322 | $etag, |
331 | 323 | $resource_url, |
332 | - (string)$http_response->getBody(), |
|
324 | + (string) $http_response->getBody(), |
|
333 | 325 | $http_response->getStatusCode() |
334 | 326 | ); |
335 | 327 | } |
@@ -346,20 +338,18 @@ discard block |
||
346 | 338 | $uid = $vo->getUID(); |
347 | 339 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
348 | 340 | $http_response = $this->makeRequest( |
349 | - RequestFactory::createPutRequest |
|
350 | - ( |
|
341 | + RequestFactory::createPutRequest( |
|
351 | 342 | $resource_url, |
352 | 343 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(), |
353 | 344 | $etag |
354 | 345 | ) |
355 | 346 | ); |
356 | 347 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
357 | - return new EventUpdatedResponse |
|
358 | - ( |
|
348 | + return new EventUpdatedResponse( |
|
359 | 349 | $uid, |
360 | 350 | $etag, |
361 | 351 | $resource_url, |
362 | - (string)$http_response->getBody(), |
|
352 | + (string) $http_response->getBody(), |
|
363 | 353 | $http_response->getStatusCode() |
364 | 354 | ); |
365 | 355 | } |
@@ -374,16 +364,14 @@ discard block |
||
374 | 364 | public function deleteEvent($calendar_url, $uid, $etag = null) |
375 | 365 | { |
376 | 366 | $http_response = $this->makeRequest( |
377 | - RequestFactory::createDeleteRequest |
|
378 | - ( |
|
367 | + RequestFactory::createDeleteRequest( |
|
379 | 368 | $calendar_url.$uid.self::SchedulingInformationSuffix, |
380 | 369 | $etag |
381 | 370 | ) |
382 | 371 | ); |
383 | 372 | |
384 | - return new EventDeletedResponse |
|
385 | - ( |
|
386 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
373 | + return new EventDeletedResponse( |
|
374 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
387 | 375 | ); |
388 | 376 | } |
389 | 377 | |
@@ -392,15 +380,14 @@ discard block |
||
392 | 380 | * @return string |
393 | 381 | * @throws \GuzzleHttp\Exception\GuzzleException |
394 | 382 | */ |
395 | - public function getEventVCardBy($event_url){ |
|
383 | + public function getEventVCardBy($event_url) { |
|
396 | 384 | $http_response = $this->makeRequest( |
397 | - RequestFactory::createGetRequest |
|
398 | - ( |
|
385 | + RequestFactory::createGetRequest( |
|
399 | 386 | $event_url |
400 | 387 | ) |
401 | 388 | ); |
402 | 389 | |
403 | - $ical = (string)$http_response->getBody(); |
|
390 | + $ical = (string) $http_response->getBody(); |
|
404 | 391 | return $ical; |
405 | 392 | } |
406 | 393 | |
@@ -413,17 +400,15 @@ discard block |
||
413 | 400 | public function getEventsBy($calendar_url, array $events_urls) |
414 | 401 | { |
415 | 402 | $http_response = $this->makeRequest( |
416 | - RequestFactory::createReportRequest |
|
417 | - ( |
|
403 | + RequestFactory::createReportRequest( |
|
418 | 404 | $calendar_url, |
419 | 405 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent() |
420 | 406 | ) |
421 | 407 | ); |
422 | 408 | |
423 | - return new ResourceCollectionResponse |
|
424 | - ( |
|
409 | + return new ResourceCollectionResponse( |
|
425 | 410 | $this->server_url, |
426 | - (string)$http_response->getBody(), |
|
411 | + (string) $http_response->getBody(), |
|
427 | 412 | $http_response->getStatusCode() |
428 | 413 | ); |
429 | 414 | } |
@@ -438,17 +423,15 @@ discard block |
||
438 | 423 | { |
439 | 424 | |
440 | 425 | $http_response = $this->makeRequest( |
441 | - RequestFactory::createReportRequest |
|
442 | - ( |
|
426 | + RequestFactory::createReportRequest( |
|
443 | 427 | $calendar_url, |
444 | 428 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent() |
445 | 429 | ) |
446 | 430 | ); |
447 | 431 | |
448 | - return new ResourceCollectionResponse |
|
449 | - ( |
|
432 | + return new ResourceCollectionResponse( |
|
450 | 433 | $this->server_url, |
451 | - (string)$http_response->getBody(), |
|
434 | + (string) $http_response->getBody(), |
|
452 | 435 | $http_response->getStatusCode() |
453 | 436 | ); |
454 | 437 | } |
@@ -462,16 +445,14 @@ discard block |
||
462 | 445 | public function deleteCalendar($calendar_url, $etag = null) |
463 | 446 | { |
464 | 447 | $http_response = $this->makeRequest( |
465 | - RequestFactory::createDeleteRequest |
|
466 | - ( |
|
448 | + RequestFactory::createDeleteRequest( |
|
467 | 449 | $calendar_url, |
468 | 450 | $etag |
469 | 451 | ) |
470 | 452 | ); |
471 | 453 | |
472 | - return new CalendarDeletedResponse |
|
473 | - ( |
|
474 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
454 | + return new CalendarDeletedResponse( |
|
455 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
475 | 456 | ); |
476 | 457 | } |
477 | 458 | } |
@@ -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; |