@@ -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; |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | |
180 | 180 | $res = $http_response->hasHeader(self::DAVHeader); |
181 | 181 | $options = []; |
182 | - if($res){ |
|
182 | + if ($res) { |
|
183 | 183 | $val = $http_response->getHeaderLine(self::DAVHeader); |
184 | - if(!empty($val)){ |
|
184 | + if (!empty($val)) { |
|
185 | 185 | $options = explode(', ', $val); |
186 | 186 | } |
187 | 187 | } |
@@ -195,14 +195,13 @@ discard block |
||
195 | 195 | public function getUserPrincipal() |
196 | 196 | { |
197 | 197 | $http_response = $this->makeRequest( |
198 | - RequestFactory::createPropFindRequest |
|
199 | - ( |
|
198 | + RequestFactory::createPropFindRequest( |
|
200 | 199 | $this->server_url, |
201 | 200 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent() |
202 | 201 | ) |
203 | 202 | ); |
204 | 203 | |
205 | - return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
204 | + return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
206 | 205 | } |
207 | 206 | |
208 | 207 | /** |
@@ -212,14 +211,13 @@ discard block |
||
212 | 211 | public function getCalendarHome($principal_url) |
213 | 212 | { |
214 | 213 | $http_response = $this->makeRequest( |
215 | - RequestFactory::createPropFindRequest |
|
216 | - ( |
|
214 | + RequestFactory::createPropFindRequest( |
|
217 | 215 | $principal_url, |
218 | 216 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent() |
219 | 217 | ) |
220 | 218 | ); |
221 | 219 | |
222 | - return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
220 | + return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
223 | 221 | } |
224 | 222 | |
225 | 223 | /** |
@@ -233,10 +231,9 @@ discard block |
||
233 | 231 | $uid = $vo->getUID(); |
234 | 232 | $resource_name = $vo->getResourceName(); |
235 | 233 | |
236 | - $resource_url = $calendar_home_set . ($resource_name ? $resource_name : $uid); |
|
234 | + $resource_url = $calendar_home_set.($resource_name ? $resource_name : $uid); |
|
237 | 235 | $http_response = $this->makeRequest( |
238 | - RequestFactory::createMakeCalendarRequest |
|
239 | - ( |
|
236 | + RequestFactory::createMakeCalendarRequest( |
|
240 | 237 | $resource_url, |
241 | 238 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent() |
242 | 239 | ) |
@@ -252,14 +249,13 @@ discard block |
||
252 | 249 | public function getCalendars($calendar_home_set_url) |
253 | 250 | { |
254 | 251 | $http_response = $this->makeRequest( |
255 | - RequestFactory::createPropFindRequest |
|
256 | - ( |
|
252 | + RequestFactory::createPropFindRequest( |
|
257 | 253 | $calendar_home_set_url, |
258 | 254 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent() |
259 | 255 | ) |
260 | 256 | ); |
261 | 257 | |
262 | - return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
258 | + return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
263 | 259 | } |
264 | 260 | |
265 | 261 | /** |
@@ -269,15 +265,14 @@ discard block |
||
269 | 265 | public function getCalendar($calendar_url) |
270 | 266 | { |
271 | 267 | $http_response = $this->makeRequest( |
272 | - RequestFactory::createPropFindRequest |
|
273 | - ( |
|
268 | + RequestFactory::createPropFindRequest( |
|
274 | 269 | $calendar_url, |
275 | 270 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(), |
276 | 271 | 0 |
277 | 272 | ) |
278 | 273 | ); |
279 | 274 | |
280 | - return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
275 | + return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
281 | 276 | } |
282 | 277 | |
283 | 278 | |
@@ -290,14 +285,13 @@ discard block |
||
290 | 285 | { |
291 | 286 | |
292 | 287 | $http_response = $this->makeRequest( |
293 | - RequestFactory::createReportRequest |
|
294 | - ( |
|
288 | + RequestFactory::createReportRequest( |
|
295 | 289 | $calendar_url, |
296 | 290 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent() |
297 | 291 | ) |
298 | 292 | ); |
299 | 293 | |
300 | - return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
294 | + return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
301 | 295 | } |
302 | 296 | |
303 | 297 | /** |
@@ -310,19 +304,17 @@ discard block |
||
310 | 304 | $uid = $vo->getUID(); |
311 | 305 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
312 | 306 | $http_response = $this->makeRequest( |
313 | - RequestFactory::createPutRequest |
|
314 | - ( |
|
307 | + RequestFactory::createPutRequest( |
|
315 | 308 | $resource_url, |
316 | 309 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent() |
317 | 310 | ) |
318 | 311 | ); |
319 | 312 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
320 | - return new EventCreatedResponse |
|
321 | - ( |
|
313 | + return new EventCreatedResponse( |
|
322 | 314 | $uid, |
323 | 315 | $etag, |
324 | 316 | $resource_url, |
325 | - (string)$http_response->getBody(), |
|
317 | + (string) $http_response->getBody(), |
|
326 | 318 | $http_response->getStatusCode() |
327 | 319 | ); |
328 | 320 | } |
@@ -338,20 +330,18 @@ discard block |
||
338 | 330 | $uid = $vo->getUID(); |
339 | 331 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
340 | 332 | $http_response = $this->makeRequest( |
341 | - RequestFactory::createPutRequest |
|
342 | - ( |
|
333 | + RequestFactory::createPutRequest( |
|
343 | 334 | $resource_url, |
344 | 335 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(), |
345 | 336 | $etag |
346 | 337 | ) |
347 | 338 | ); |
348 | 339 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
349 | - return new EventUpdatedResponse |
|
350 | - ( |
|
340 | + return new EventUpdatedResponse( |
|
351 | 341 | $uid, |
352 | 342 | $etag, |
353 | 343 | $resource_url, |
354 | - (string)$http_response->getBody(), |
|
344 | + (string) $http_response->getBody(), |
|
355 | 345 | $http_response->getStatusCode() |
356 | 346 | ); |
357 | 347 | } |
@@ -365,16 +355,14 @@ discard block |
||
365 | 355 | public function deleteEvent($calendar_url, $uid, $etag = null) |
366 | 356 | { |
367 | 357 | $http_response = $this->makeRequest( |
368 | - RequestFactory::createDeleteRequest |
|
369 | - ( |
|
358 | + RequestFactory::createDeleteRequest( |
|
370 | 359 | $calendar_url.$uid.self::SchedulingInformationSuffix, |
371 | 360 | $etag |
372 | 361 | ) |
373 | 362 | ); |
374 | 363 | |
375 | - return new EventDeletedResponse |
|
376 | - ( |
|
377 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
364 | + return new EventDeletedResponse( |
|
365 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
378 | 366 | ); |
379 | 367 | } |
380 | 368 | |
@@ -382,15 +370,14 @@ discard block |
||
382 | 370 | * @param string $event_url |
383 | 371 | * @return string |
384 | 372 | */ |
385 | - public function getEventVCardBy($event_url){ |
|
373 | + public function getEventVCardBy($event_url) { |
|
386 | 374 | $http_response = $this->makeRequest( |
387 | - RequestFactory::createGetRequest |
|
388 | - ( |
|
375 | + RequestFactory::createGetRequest( |
|
389 | 376 | $event_url |
390 | 377 | ) |
391 | 378 | ); |
392 | 379 | |
393 | - $ical = (string)$http_response->getBody(); |
|
380 | + $ical = (string) $http_response->getBody(); |
|
394 | 381 | return $ical; |
395 | 382 | } |
396 | 383 | |
@@ -402,17 +389,15 @@ discard block |
||
402 | 389 | public function getEventsBy($calendar_url, array $events_urls) |
403 | 390 | { |
404 | 391 | $http_response = $this->makeRequest( |
405 | - RequestFactory::createReportRequest |
|
406 | - ( |
|
392 | + RequestFactory::createReportRequest( |
|
407 | 393 | $calendar_url, |
408 | 394 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent() |
409 | 395 | ) |
410 | 396 | ); |
411 | 397 | |
412 | - return new ResourceCollectionResponse |
|
413 | - ( |
|
398 | + return new ResourceCollectionResponse( |
|
414 | 399 | $this->server_url, |
415 | - (string)$http_response->getBody(), |
|
400 | + (string) $http_response->getBody(), |
|
416 | 401 | $http_response->getStatusCode() |
417 | 402 | ); |
418 | 403 | } |
@@ -426,17 +411,15 @@ discard block |
||
426 | 411 | { |
427 | 412 | |
428 | 413 | $http_response = $this->makeRequest( |
429 | - RequestFactory::createReportRequest |
|
430 | - ( |
|
414 | + RequestFactory::createReportRequest( |
|
431 | 415 | $calendar_url, |
432 | 416 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent() |
433 | 417 | ) |
434 | 418 | ); |
435 | 419 | |
436 | - return new ResourceCollectionResponse |
|
437 | - ( |
|
420 | + return new ResourceCollectionResponse( |
|
438 | 421 | $this->server_url, |
439 | - (string)$http_response->getBody(), |
|
422 | + (string) $http_response->getBody(), |
|
440 | 423 | $http_response->getStatusCode() |
441 | 424 | ); |
442 | 425 | } |
@@ -449,16 +432,14 @@ discard block |
||
449 | 432 | public function deleteCalendar($calendar_url, $etag = null) |
450 | 433 | { |
451 | 434 | $http_response = $this->makeRequest( |
452 | - RequestFactory::createDeleteRequest |
|
453 | - ( |
|
435 | + RequestFactory::createDeleteRequest( |
|
454 | 436 | $calendar_url, |
455 | 437 | $etag |
456 | 438 | ) |
457 | 439 | ); |
458 | 440 | |
459 | - return new CalendarDeletedResponse |
|
460 | - ( |
|
461 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
441 | + return new CalendarDeletedResponse( |
|
442 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
462 | 443 | ); |
463 | 444 | } |
464 | 445 | } |
@@ -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; |