@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $this->timezone = $timezone; |
| 61 | 61 | $this->uid = md5(uniqid(mt_rand(), true)); |
| 62 | 62 | |
| 63 | - if(is_null($this->timezone)){ |
|
| 63 | + if (is_null($this->timezone)) { |
|
| 64 | 64 | $this->timezone = new DateTimeZone('UTC'); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * @param string $uid |
| 70 | 70 | */ |
| 71 | - public function setUID($uid){ |
|
| 71 | + public function setUID($uid) { |
|
| 72 | 72 | $this->uid = $uid; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * @param array $params |
| 27 | 27 | * @return array |
| 28 | 28 | */ |
| 29 | - private static function createHeadersFor($http_method, array $params = []){ |
|
| 30 | - switch ($http_method){ |
|
| 29 | + private static function createHeadersFor($http_method, array $params = []) { |
|
| 30 | + switch ($http_method) { |
|
| 31 | 31 | case HttpMethods::PropFind: |
| 32 | 32 | case HttpMethods::Options: |
| 33 | 33 | case HttpMethods::Report: |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ]; |
| 39 | 39 | case HttpMethods::Delete: |
| 40 | 40 | $etag = $params[0]; |
| 41 | - if(!empty($etag)) { |
|
| 41 | + if (!empty($etag)) { |
|
| 42 | 42 | return [ |
| 43 | 43 | Headers::IfMatch => $etag, |
| 44 | 44 | ]; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ]; |
| 51 | 51 | case HttpMethods::Put: |
| 52 | 52 | $etag = $params[0]; |
| 53 | - if(!empty($etag)){ |
|
| 53 | + if (!empty($etag)) { |
|
| 54 | 54 | return [ |
| 55 | 55 | Headers::ContentType => ContentTypes::Calendar, |
| 56 | 56 | Headers::IfMatch => $etag |
@@ -65,11 +65,10 @@ discard block |
||
| 65 | 65 | * @param int $depth |
| 66 | 66 | * @return Request |
| 67 | 67 | */ |
| 68 | - public static function createPropFindRequest($url , $body, $depth = 1){ |
|
| 69 | - return new Request |
|
| 70 | - ( |
|
| 68 | + public static function createPropFindRequest($url, $body, $depth = 1) { |
|
| 69 | + return new Request( |
|
| 71 | 70 | HttpMethods::PropFind, |
| 72 | - $url , |
|
| 71 | + $url, |
|
| 73 | 72 | self::createHeadersFor(HttpMethods::PropFind, [$depth]), |
| 74 | 73 | $body |
| 75 | 74 | ); |
@@ -80,9 +79,8 @@ discard block |
||
| 80 | 79 | * @param string $body |
| 81 | 80 | * @return Request |
| 82 | 81 | */ |
| 83 | - public static function createMakeCalendarRequest($url , $body){ |
|
| 84 | - return new Request |
|
| 85 | - ( |
|
| 82 | + public static function createMakeCalendarRequest($url, $body) { |
|
| 83 | + return new Request( |
|
| 86 | 84 | HttpMethods::MakeCalendar, |
| 87 | 85 | $url, |
| 88 | 86 | self::createHeadersFor(HttpMethods::MakeCalendar), |
@@ -95,9 +93,8 @@ discard block |
||
| 95 | 93 | * @param int $depth |
| 96 | 94 | * @return Request |
| 97 | 95 | */ |
| 98 | - public static function createOptionsRequest($url, $depth = 1){ |
|
| 99 | - return new Request |
|
| 100 | - ( |
|
| 96 | + public static function createOptionsRequest($url, $depth = 1) { |
|
| 97 | + return new Request( |
|
| 101 | 98 | HttpMethods::Options, |
| 102 | 99 | $url, |
| 103 | 100 | self::createHeadersFor(HttpMethods::Options, [$depth]) |
@@ -110,9 +107,8 @@ discard block |
||
| 110 | 107 | * @param int $depth |
| 111 | 108 | * @return Request |
| 112 | 109 | */ |
| 113 | - public static function createReportRequest($url , $body, $depth = 1){ |
|
| 114 | - return new Request |
|
| 115 | - ( |
|
| 110 | + public static function createReportRequest($url, $body, $depth = 1) { |
|
| 111 | + return new Request( |
|
| 116 | 112 | HttpMethods::Report, |
| 117 | 113 | $url, |
| 118 | 114 | self::createHeadersFor(HttpMethods::Report, [$depth]), |
@@ -125,9 +121,8 @@ discard block |
||
| 125 | 121 | * @param string $etag |
| 126 | 122 | * @return Request |
| 127 | 123 | */ |
| 128 | - public static function createDeleteRequest($url , $etag){ |
|
| 129 | - return new Request |
|
| 130 | - ( |
|
| 124 | + public static function createDeleteRequest($url, $etag) { |
|
| 125 | + return new Request( |
|
| 131 | 126 | HttpMethods::Delete, |
| 132 | 127 | $url, |
| 133 | 128 | self::createHeadersFor(HttpMethods::Delete, [$etag]) |
@@ -138,9 +133,8 @@ discard block |
||
| 138 | 133 | * @param string $url |
| 139 | 134 | * @return Request |
| 140 | 135 | */ |
| 141 | - public static function createGetRequest($url){ |
|
| 142 | - return new Request |
|
| 143 | - ( |
|
| 136 | + public static function createGetRequest($url) { |
|
| 137 | + return new Request( |
|
| 144 | 138 | HttpMethods::Get, |
| 145 | 139 | $url, |
| 146 | 140 | self::createHeadersFor(HttpMethods::Get) |
@@ -153,9 +147,8 @@ discard block |
||
| 153 | 147 | * @param string $etag |
| 154 | 148 | * @return Request |
| 155 | 149 | */ |
| 156 | - public static function createPutRequest($url, $body, $etag = null){ |
|
| 157 | - return new Request |
|
| 158 | - ( |
|
| 150 | + public static function createPutRequest($url, $body, $etag = null) { |
|
| 151 | + return new Request( |
|
| 159 | 152 | HttpMethods::Put, |
| 160 | 153 | $url, |
| 161 | 154 | self::createHeadersFor(HttpMethods::Put, [$etag]), |
@@ -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 | [ |
@@ -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 | } |
@@ -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; |
@@ -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 | |
@@ -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 | } |