@@ -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 | /** |
@@ -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; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param string $authtype |
| 109 | 109 | * @param array $headers Additional headers to send with each request |
| 110 | 110 | */ |
| 111 | - public function __construct($server_url, $user = null, $password = null, $authtype = self::DefaultAuthType, $headers=[]) |
|
| 111 | + public function __construct($server_url, $user = null, $password = null, $authtype = self::DefaultAuthType, $headers = []) |
|
| 112 | 112 | { |
| 113 | 113 | $this->server_url = $server_url; |
| 114 | 114 | $this->user = $user; |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | * @return mixed|\Psr\Http\Message\ResponseInterface |
| 158 | 158 | * @throws \GuzzleHttp\Exception\GuzzleException |
| 159 | 159 | */ |
| 160 | - private function makeRequest(Request $http_request){ |
|
| 161 | - try{ |
|
| 160 | + private function makeRequest(Request $http_request) { |
|
| 161 | + try { |
|
| 162 | 162 | $options = [ |
| 163 | 163 | 'timeout' => $this->timeout |
| 164 | 164 | ]; |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | return $this->client->send($http_request, $options); |
| 178 | 178 | } |
| 179 | - catch (ClientException $ex){ |
|
| 180 | - switch($ex->getCode()){ |
|
| 179 | + catch (ClientException $ex) { |
|
| 180 | + switch ($ex->getCode()) { |
|
| 181 | 181 | case 401: |
| 182 | 182 | throw new UserUnAuthorizedException(); |
| 183 | 183 | break; |
@@ -210,9 +210,9 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | $res = $http_response->hasHeader(self::DAVHeader); |
| 212 | 212 | $options = []; |
| 213 | - if($res){ |
|
| 213 | + if ($res) { |
|
| 214 | 214 | $val = $http_response->getHeaderLine(self::DAVHeader); |
| 215 | - if(!empty($val)){ |
|
| 215 | + if (!empty($val)) { |
|
| 216 | 216 | $options = explode(', ', $val); |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -226,14 +226,13 @@ discard block |
||
| 226 | 226 | public function getUserPrincipal() |
| 227 | 227 | { |
| 228 | 228 | $http_response = $this->makeRequest( |
| 229 | - RequestFactory::createPropFindRequest |
|
| 230 | - ( |
|
| 229 | + RequestFactory::createPropFindRequest( |
|
| 231 | 230 | $this->server_url, |
| 232 | 231 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent() |
| 233 | 232 | ) |
| 234 | 233 | ); |
| 235 | 234 | |
| 236 | - return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 235 | + return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 237 | 236 | } |
| 238 | 237 | |
| 239 | 238 | /** |
@@ -244,14 +243,13 @@ discard block |
||
| 244 | 243 | public function getCalendarHome($principal_url) |
| 245 | 244 | { |
| 246 | 245 | $http_response = $this->makeRequest( |
| 247 | - RequestFactory::createPropFindRequest |
|
| 248 | - ( |
|
| 246 | + RequestFactory::createPropFindRequest( |
|
| 249 | 247 | $principal_url, |
| 250 | 248 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent() |
| 251 | 249 | ) |
| 252 | 250 | ); |
| 253 | 251 | |
| 254 | - return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 252 | + return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 255 | 253 | } |
| 256 | 254 | |
| 257 | 255 | /** |
@@ -266,10 +264,9 @@ discard block |
||
| 266 | 264 | $uid = $vo->getUID(); |
| 267 | 265 | $resource_name = $vo->getResourceName(); |
| 268 | 266 | |
| 269 | - $resource_url = $calendar_home_set . ($resource_name ? $resource_name : $uid); |
|
| 267 | + $resource_url = $calendar_home_set.($resource_name ? $resource_name : $uid); |
|
| 270 | 268 | $http_response = $this->makeRequest( |
| 271 | - RequestFactory::createMakeCalendarRequest |
|
| 272 | - ( |
|
| 269 | + RequestFactory::createMakeCalendarRequest( |
|
| 273 | 270 | $resource_url, |
| 274 | 271 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent() |
| 275 | 272 | ) |
@@ -286,14 +283,13 @@ discard block |
||
| 286 | 283 | public function getCalendars($calendar_home_set_url) |
| 287 | 284 | { |
| 288 | 285 | $http_response = $this->makeRequest( |
| 289 | - RequestFactory::createPropFindRequest |
|
| 290 | - ( |
|
| 286 | + RequestFactory::createPropFindRequest( |
|
| 291 | 287 | $calendar_home_set_url, |
| 292 | 288 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent() |
| 293 | 289 | ) |
| 294 | 290 | ); |
| 295 | 291 | |
| 296 | - return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 292 | + return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 297 | 293 | } |
| 298 | 294 | |
| 299 | 295 | /** |
@@ -304,15 +300,14 @@ discard block |
||
| 304 | 300 | public function getCalendar($calendar_url) |
| 305 | 301 | { |
| 306 | 302 | $http_response = $this->makeRequest( |
| 307 | - RequestFactory::createPropFindRequest |
|
| 308 | - ( |
|
| 303 | + RequestFactory::createPropFindRequest( |
|
| 309 | 304 | $calendar_url, |
| 310 | 305 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(), |
| 311 | 306 | 0 |
| 312 | 307 | ) |
| 313 | 308 | ); |
| 314 | 309 | |
| 315 | - return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 310 | + return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 316 | 311 | } |
| 317 | 312 | |
| 318 | 313 | |
@@ -326,14 +321,13 @@ discard block |
||
| 326 | 321 | { |
| 327 | 322 | |
| 328 | 323 | $http_response = $this->makeRequest( |
| 329 | - RequestFactory::createReportRequest |
|
| 330 | - ( |
|
| 324 | + RequestFactory::createReportRequest( |
|
| 331 | 325 | $calendar_url, |
| 332 | 326 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent() |
| 333 | 327 | ) |
| 334 | 328 | ); |
| 335 | 329 | |
| 336 | - return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
| 330 | + return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
| 337 | 331 | } |
| 338 | 332 | |
| 339 | 333 | /** |
@@ -347,19 +341,17 @@ discard block |
||
| 347 | 341 | $uid = $vo->getUID(); |
| 348 | 342 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
| 349 | 343 | $http_response = $this->makeRequest( |
| 350 | - RequestFactory::createPutRequest |
|
| 351 | - ( |
|
| 344 | + RequestFactory::createPutRequest( |
|
| 352 | 345 | $resource_url, |
| 353 | 346 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent() |
| 354 | 347 | ) |
| 355 | 348 | ); |
| 356 | 349 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
| 357 | - return new EventCreatedResponse |
|
| 358 | - ( |
|
| 350 | + return new EventCreatedResponse( |
|
| 359 | 351 | $uid, |
| 360 | 352 | $etag, |
| 361 | 353 | $resource_url, |
| 362 | - (string)$http_response->getBody(), |
|
| 354 | + (string) $http_response->getBody(), |
|
| 363 | 355 | $http_response->getStatusCode() |
| 364 | 356 | ); |
| 365 | 357 | } |
@@ -376,20 +368,18 @@ discard block |
||
| 376 | 368 | $uid = $vo->getUID(); |
| 377 | 369 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
| 378 | 370 | $http_response = $this->makeRequest( |
| 379 | - RequestFactory::createPutRequest |
|
| 380 | - ( |
|
| 371 | + RequestFactory::createPutRequest( |
|
| 381 | 372 | $resource_url, |
| 382 | 373 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(), |
| 383 | 374 | $etag |
| 384 | 375 | ) |
| 385 | 376 | ); |
| 386 | 377 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
| 387 | - return new EventUpdatedResponse |
|
| 388 | - ( |
|
| 378 | + return new EventUpdatedResponse( |
|
| 389 | 379 | $uid, |
| 390 | 380 | $etag, |
| 391 | 381 | $resource_url, |
| 392 | - (string)$http_response->getBody(), |
|
| 382 | + (string) $http_response->getBody(), |
|
| 393 | 383 | $http_response->getStatusCode() |
| 394 | 384 | ); |
| 395 | 385 | } |
@@ -404,16 +394,14 @@ discard block |
||
| 404 | 394 | public function deleteEvent($calendar_url, $uid, $etag = null) |
| 405 | 395 | { |
| 406 | 396 | $http_response = $this->makeRequest( |
| 407 | - RequestFactory::createDeleteRequest |
|
| 408 | - ( |
|
| 397 | + RequestFactory::createDeleteRequest( |
|
| 409 | 398 | $calendar_url.$uid.self::SchedulingInformationSuffix, |
| 410 | 399 | $etag |
| 411 | 400 | ) |
| 412 | 401 | ); |
| 413 | 402 | |
| 414 | - return new EventDeletedResponse |
|
| 415 | - ( |
|
| 416 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
| 403 | + return new EventDeletedResponse( |
|
| 404 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
| 417 | 405 | ); |
| 418 | 406 | } |
| 419 | 407 | |
@@ -422,15 +410,14 @@ discard block |
||
| 422 | 410 | * @return string |
| 423 | 411 | * @throws \GuzzleHttp\Exception\GuzzleException |
| 424 | 412 | */ |
| 425 | - public function getEventVCardBy($event_url){ |
|
| 413 | + public function getEventVCardBy($event_url) { |
|
| 426 | 414 | $http_response = $this->makeRequest( |
| 427 | - RequestFactory::createGetRequest |
|
| 428 | - ( |
|
| 415 | + RequestFactory::createGetRequest( |
|
| 429 | 416 | $event_url |
| 430 | 417 | ) |
| 431 | 418 | ); |
| 432 | 419 | |
| 433 | - $ical = (string)$http_response->getBody(); |
|
| 420 | + $ical = (string) $http_response->getBody(); |
|
| 434 | 421 | return $ical; |
| 435 | 422 | } |
| 436 | 423 | |
@@ -443,17 +430,15 @@ discard block |
||
| 443 | 430 | public function getEventsBy($calendar_url, array $events_urls) |
| 444 | 431 | { |
| 445 | 432 | $http_response = $this->makeRequest( |
| 446 | - RequestFactory::createReportRequest |
|
| 447 | - ( |
|
| 433 | + RequestFactory::createReportRequest( |
|
| 448 | 434 | $calendar_url, |
| 449 | 435 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent() |
| 450 | 436 | ) |
| 451 | 437 | ); |
| 452 | 438 | |
| 453 | - return new ResourceCollectionResponse |
|
| 454 | - ( |
|
| 439 | + return new ResourceCollectionResponse( |
|
| 455 | 440 | $this->server_url, |
| 456 | - (string)$http_response->getBody(), |
|
| 441 | + (string) $http_response->getBody(), |
|
| 457 | 442 | $http_response->getStatusCode() |
| 458 | 443 | ); |
| 459 | 444 | } |
@@ -468,17 +453,15 @@ discard block |
||
| 468 | 453 | { |
| 469 | 454 | |
| 470 | 455 | $http_response = $this->makeRequest( |
| 471 | - RequestFactory::createReportRequest |
|
| 472 | - ( |
|
| 456 | + RequestFactory::createReportRequest( |
|
| 473 | 457 | $calendar_url, |
| 474 | 458 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent() |
| 475 | 459 | ) |
| 476 | 460 | ); |
| 477 | 461 | |
| 478 | - return new ResourceCollectionResponse |
|
| 479 | - ( |
|
| 462 | + return new ResourceCollectionResponse( |
|
| 480 | 463 | $this->server_url, |
| 481 | - (string)$http_response->getBody(), |
|
| 464 | + (string) $http_response->getBody(), |
|
| 482 | 465 | $http_response->getStatusCode() |
| 483 | 466 | ); |
| 484 | 467 | } |
@@ -492,16 +475,14 @@ discard block |
||
| 492 | 475 | public function deleteCalendar($calendar_url, $etag = null) |
| 493 | 476 | { |
| 494 | 477 | $http_response = $this->makeRequest( |
| 495 | - RequestFactory::createDeleteRequest |
|
| 496 | - ( |
|
| 478 | + RequestFactory::createDeleteRequest( |
|
| 497 | 479 | $calendar_url, |
| 498 | 480 | $etag |
| 499 | 481 | ) |
| 500 | 482 | ); |
| 501 | 483 | |
| 502 | - return new CalendarDeletedResponse |
|
| 503 | - ( |
|
| 504 | - (string)$http_response->getBody(), $http_response->getStatusCode() |
|
| 484 | + return new CalendarDeletedResponse( |
|
| 485 | + (string) $http_response->getBody(), $http_response->getStatusCode() |
|
| 505 | 486 | ); |
| 506 | 487 | } |
| 507 | 488 | } |
@@ -175,8 +175,7 @@ |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $this->client->send($http_request, $options); |
| 178 | - } |
|
| 179 | - catch (ClientException $ex){ |
|
| 178 | + } catch (ClientException $ex){ |
|
| 180 | 179 | switch($ex->getCode()){ |
| 181 | 180 | case 401: |
| 182 | 181 | throw new UserUnAuthorizedException(); |
@@ -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,21 +34,21 @@ 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 getETag(){ |
|
| 44 | + public function getETag() { |
|
| 45 | 45 | return isset($this->found_props['getetag']) ? $this->found_props['getetag'] : null; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - public function getCTag(){ |
|
| 51 | + public function getCTag() { |
|
| 52 | 52 | return isset($this->found_props['getctag']) ? $this->found_props['getctag'] : null; |
| 53 | 53 | } |
| 54 | 54 | |