@@ -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(); |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | * @param Request $http_request |
| 138 | 138 | * @return mixed|\Psr\Http\Message\ResponseInterface |
| 139 | 139 | */ |
| 140 | - private function makeRequest(Request $http_request){ |
|
| 141 | - try{ |
|
| 140 | + private function makeRequest(Request $http_request) { |
|
| 141 | + try { |
|
| 142 | 142 | return $this->client->send($http_request, [ |
| 143 | 143 | 'auth' => [$this->user, $this->password, $this->authtype], |
| 144 | 144 | 'timeout' => $this->timeout |
| 145 | 145 | ]); |
| 146 | 146 | } |
| 147 | - catch (ClientException $ex){ |
|
| 148 | - switch($ex->getCode()){ |
|
| 147 | + catch (ClientException $ex) { |
|
| 148 | + switch ($ex->getCode()) { |
|
| 149 | 149 | case 401: |
| 150 | 150 | throw new UserUnAuthorizedException(); |
| 151 | 151 | break; |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $res = $http_response->hasHeader(self::DAVHeader); |
| 175 | 175 | $options = []; |
| 176 | - if($res){ |
|
| 176 | + if ($res) { |
|
| 177 | 177 | $val = $http_response->getHeaderLine(self::DAVHeader); |
| 178 | - if(!empty($val)){ |
|
| 178 | + if (!empty($val)) { |
|
| 179 | 179 | $options = explode(', ', $val); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -189,14 +189,13 @@ discard block |
||
| 189 | 189 | public function getUserPrincipal() |
| 190 | 190 | { |
| 191 | 191 | $http_response = $this->makeRequest( |
| 192 | - RequestFactory::createPropFindRequest |
|
| 193 | - ( |
|
| 192 | + RequestFactory::createPropFindRequest( |
|
| 194 | 193 | $this->server_url, |
| 195 | 194 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent() |
| 196 | 195 | ) |
| 197 | 196 | ); |
| 198 | 197 | |
| 199 | - return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 198 | + return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 200 | 199 | } |
| 201 | 200 | |
| 202 | 201 | /** |
@@ -206,14 +205,13 @@ discard block |
||
| 206 | 205 | public function getCalendarHome($principal_url) |
| 207 | 206 | { |
| 208 | 207 | $http_response = $this->makeRequest( |
| 209 | - RequestFactory::createPropFindRequest |
|
| 210 | - ( |
|
| 208 | + RequestFactory::createPropFindRequest( |
|
| 211 | 209 | $principal_url, |
| 212 | 210 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent() |
| 213 | 211 | ) |
| 214 | 212 | ); |
| 215 | 213 | |
| 216 | - return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 214 | + return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 217 | 215 | } |
| 218 | 216 | |
| 219 | 217 | /** |
@@ -227,10 +225,9 @@ discard block |
||
| 227 | 225 | $uid = $vo->getUID(); |
| 228 | 226 | $resource_name = $vo->getResourceName(); |
| 229 | 227 | |
| 230 | - $resource_url = $calendar_home_set . ($resource_name ? $resource_name : $uid); |
|
| 228 | + $resource_url = $calendar_home_set.($resource_name ? $resource_name : $uid); |
|
| 231 | 229 | $http_response = $this->makeRequest( |
| 232 | - RequestFactory::createMakeCalendarRequest |
|
| 233 | - ( |
|
| 230 | + RequestFactory::createMakeCalendarRequest( |
|
| 234 | 231 | $resource_url, |
| 235 | 232 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent() |
| 236 | 233 | ) |
@@ -246,14 +243,13 @@ discard block |
||
| 246 | 243 | public function getCalendars($calendar_home_set_url) |
| 247 | 244 | { |
| 248 | 245 | $http_response = $this->makeRequest( |
| 249 | - RequestFactory::createPropFindRequest |
|
| 250 | - ( |
|
| 246 | + RequestFactory::createPropFindRequest( |
|
| 251 | 247 | $calendar_home_set_url, |
| 252 | 248 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent() |
| 253 | 249 | ) |
| 254 | 250 | ); |
| 255 | 251 | |
| 256 | - return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 252 | + return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 257 | 253 | } |
| 258 | 254 | |
| 259 | 255 | /** |
@@ -263,15 +259,14 @@ discard block |
||
| 263 | 259 | public function getCalendar($calendar_url) |
| 264 | 260 | { |
| 265 | 261 | $http_response = $this->makeRequest( |
| 266 | - RequestFactory::createPropFindRequest |
|
| 267 | - ( |
|
| 262 | + RequestFactory::createPropFindRequest( |
|
| 268 | 263 | $calendar_url, |
| 269 | 264 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(), |
| 270 | 265 | 0 |
| 271 | 266 | ) |
| 272 | 267 | ); |
| 273 | 268 | |
| 274 | - return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 269 | + return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 275 | 270 | } |
| 276 | 271 | |
| 277 | 272 | |
@@ -284,14 +279,13 @@ discard block |
||
| 284 | 279 | { |
| 285 | 280 | |
| 286 | 281 | $http_response = $this->makeRequest( |
| 287 | - RequestFactory::createReportRequest |
|
| 288 | - ( |
|
| 282 | + RequestFactory::createReportRequest( |
|
| 289 | 283 | $calendar_url, |
| 290 | 284 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent() |
| 291 | 285 | ) |
| 292 | 286 | ); |
| 293 | 287 | |
| 294 | - return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 288 | + return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 295 | 289 | } |
| 296 | 290 | |
| 297 | 291 | /** |
@@ -304,19 +298,17 @@ discard block |
||
| 304 | 298 | $uid = $vo->getUID(); |
| 305 | 299 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
| 306 | 300 | $http_response = $this->makeRequest( |
| 307 | - RequestFactory::createPutRequest |
|
| 308 | - ( |
|
| 301 | + RequestFactory::createPutRequest( |
|
| 309 | 302 | $resource_url, |
| 310 | 303 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent() |
| 311 | 304 | ) |
| 312 | 305 | ); |
| 313 | 306 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
| 314 | - return new EventCreatedResponse |
|
| 315 | - ( |
|
| 307 | + return new EventCreatedResponse( |
|
| 316 | 308 | $uid, |
| 317 | 309 | $etag, |
| 318 | 310 | $resource_url, |
| 319 | - (string)$http_response->getBody(), |
|
| 311 | + (string) $http_response->getBody(), |
|
| 320 | 312 | $http_response->getStatusCode() |
| 321 | 313 | ); |
| 322 | 314 | } |
@@ -332,20 +324,18 @@ discard block |
||
| 332 | 324 | $uid = $vo->getUID(); |
| 333 | 325 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
| 334 | 326 | $http_response = $this->makeRequest( |
| 335 | - RequestFactory::createPutRequest |
|
| 336 | - ( |
|
| 327 | + RequestFactory::createPutRequest( |
|
| 337 | 328 | $resource_url, |
| 338 | 329 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(), |
| 339 | 330 | $etag |
| 340 | 331 | ) |
| 341 | 332 | ); |
| 342 | 333 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
| 343 | - return new EventUpdatedResponse |
|
| 344 | - ( |
|
| 334 | + return new EventUpdatedResponse( |
|
| 345 | 335 | $uid, |
| 346 | 336 | $etag, |
| 347 | 337 | $resource_url, |
| 348 | - (string)$http_response->getBody(), |
|
| 338 | + (string) $http_response->getBody(), |
|
| 349 | 339 | $http_response->getStatusCode() |
| 350 | 340 | ); |
| 351 | 341 | } |
@@ -359,16 +349,14 @@ discard block |
||
| 359 | 349 | public function deleteEvent($calendar_url, $uid, $etag = null) |
| 360 | 350 | { |
| 361 | 351 | $http_response = $this->makeRequest( |
| 362 | - RequestFactory::createDeleteRequest |
|
| 363 | - ( |
|
| 352 | + RequestFactory::createDeleteRequest( |
|
| 364 | 353 | $calendar_url.$uid.self::SchedulingInformationSuffix, |
| 365 | 354 | $etag |
| 366 | 355 | ) |
| 367 | 356 | ); |
| 368 | 357 | |
| 369 | - return new EventDeletedResponse |
|
| 370 | - ( |
|
| 371 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
| 358 | + return new EventDeletedResponse( |
|
| 359 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
| 372 | 360 | ); |
| 373 | 361 | } |
| 374 | 362 | |
@@ -376,15 +364,14 @@ discard block |
||
| 376 | 364 | * @param string $event_url |
| 377 | 365 | * @return string |
| 378 | 366 | */ |
| 379 | - public function getEventVCardBy($event_url){ |
|
| 367 | + public function getEventVCardBy($event_url) { |
|
| 380 | 368 | $http_response = $this->makeRequest( |
| 381 | - RequestFactory::createGetRequest |
|
| 382 | - ( |
|
| 369 | + RequestFactory::createGetRequest( |
|
| 383 | 370 | $event_url |
| 384 | 371 | ) |
| 385 | 372 | ); |
| 386 | 373 | |
| 387 | - $ical = (string)$http_response->getBody(); |
|
| 374 | + $ical = (string) $http_response->getBody(); |
|
| 388 | 375 | return $ical; |
| 389 | 376 | } |
| 390 | 377 | |
@@ -396,17 +383,15 @@ discard block |
||
| 396 | 383 | public function getEventsBy($calendar_url, array $events_urls) |
| 397 | 384 | { |
| 398 | 385 | $http_response = $this->makeRequest( |
| 399 | - RequestFactory::createReportRequest |
|
| 400 | - ( |
|
| 386 | + RequestFactory::createReportRequest( |
|
| 401 | 387 | $calendar_url, |
| 402 | 388 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent() |
| 403 | 389 | ) |
| 404 | 390 | ); |
| 405 | 391 | |
| 406 | - return new ResourceCollectionResponse |
|
| 407 | - ( |
|
| 392 | + return new ResourceCollectionResponse( |
|
| 408 | 393 | $this->server_url, |
| 409 | - (string)$http_response->getBody(), |
|
| 394 | + (string) $http_response->getBody(), |
|
| 410 | 395 | $http_response->getStatusCode() |
| 411 | 396 | ); |
| 412 | 397 | } |
@@ -420,17 +405,15 @@ discard block |
||
| 420 | 405 | { |
| 421 | 406 | |
| 422 | 407 | $http_response = $this->makeRequest( |
| 423 | - RequestFactory::createReportRequest |
|
| 424 | - ( |
|
| 408 | + RequestFactory::createReportRequest( |
|
| 425 | 409 | $calendar_url, |
| 426 | 410 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent() |
| 427 | 411 | ) |
| 428 | 412 | ); |
| 429 | 413 | |
| 430 | - return new ResourceCollectionResponse |
|
| 431 | - ( |
|
| 414 | + return new ResourceCollectionResponse( |
|
| 432 | 415 | $this->server_url, |
| 433 | - (string)$http_response->getBody(), |
|
| 416 | + (string) $http_response->getBody(), |
|
| 434 | 417 | $http_response->getStatusCode() |
| 435 | 418 | ); |
| 436 | 419 | } |
@@ -443,16 +426,14 @@ discard block |
||
| 443 | 426 | public function deleteCalendar($calendar_url, $etag = null) |
| 444 | 427 | { |
| 445 | 428 | $http_response = $this->makeRequest( |
| 446 | - RequestFactory::createDeleteRequest |
|
| 447 | - ( |
|
| 429 | + RequestFactory::createDeleteRequest( |
|
| 448 | 430 | $calendar_url, |
| 449 | 431 | $etag |
| 450 | 432 | ) |
| 451 | 433 | ); |
| 452 | 434 | |
| 453 | - return new CalendarDeletedResponse |
|
| 454 | - ( |
|
| 455 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
| 435 | + return new CalendarDeletedResponse( |
|
| 436 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
| 456 | 437 | ); |
| 457 | 438 | } |
| 458 | 439 | } |
@@ -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 | |
@@ -32,11 +32,11 @@ |
||
| 32 | 32 | * @param string $type |
| 33 | 33 | * @return array |
| 34 | 34 | */ |
| 35 | - public function getResponseByType($type){ |
|
| 35 | + public function getResponseByType($type) { |
|
| 36 | 36 | $responses = []; |
| 37 | - foreach ($this->getResponses() as $response){ |
|
| 37 | + foreach ($this->getResponses() as $response) { |
|
| 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 | return $responses; |
| 42 | 42 | } |
@@ -36,7 +36,9 @@ |
||
| 36 | 36 | $responses = []; |
| 37 | 37 | foreach ($this->getResponses() as $response){ |
| 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))) { |
|
| 40 | + $responses[] = $response; |
|
| 41 | + } |
|
| 40 | 42 | } |
| 41 | 43 | return $responses; |
| 42 | 44 | } |