@@ -60,8 +60,7 @@ |
||
60 | 60 | if($time_zone->getName() == 'UTC'){ |
61 | 61 | $event->setUseUtc(true) |
62 | 62 | ->setUseTimezone(false); |
63 | - } |
|
64 | - else{ |
|
63 | + } else{ |
|
65 | 64 | $event->setUseUtc(false) |
66 | 65 | ->setUseTimezone(true); |
67 | 66 | } |
@@ -41,8 +41,12 @@ discard block |
||
41 | 41 | protected function parse() |
42 | 42 | { |
43 | 43 | |
44 | - if (!$this->isValid()) throw new NotValidGenericSingleCalDAVResponseException(); |
|
45 | - if (!isset($this->content['response']['propstat'])) return $this; |
|
44 | + if (!$this->isValid()) { |
|
45 | + throw new NotValidGenericSingleCalDAVResponseException(); |
|
46 | + } |
|
47 | + if (!isset($this->content['response']['propstat'])) { |
|
48 | + return $this; |
|
49 | + } |
|
46 | 50 | if (isset($this->content['response']['propstat']['prop']) && isset($this->content['response']['propstat']['status'])) { |
47 | 51 | // all props found |
48 | 52 | $status = $this->content['response']['propstat']['status']; |
@@ -62,13 +66,17 @@ discard block |
||
62 | 66 | // multi props ( found or not found) |
63 | 67 | foreach ($this->content['response']['propstat'] as $propstat) { |
64 | 68 | |
65 | - if (!isset($propstat['status']) || !isset($propstat['prop'])) continue; |
|
69 | + if (!isset($propstat['status']) || !isset($propstat['prop'])) { |
|
70 | + continue; |
|
71 | + } |
|
66 | 72 | |
67 | - if ($propstat['status'] == AbstractCalDAVResponse::HttpOKStatus) |
|
68 | - $this->found_props = $propstat['prop']; |
|
73 | + if ($propstat['status'] == AbstractCalDAVResponse::HttpOKStatus) { |
|
74 | + $this->found_props = $propstat['prop']; |
|
75 | + } |
|
69 | 76 | |
70 | - if ($propstat['status'] == AbstractCalDAVResponse::HttpNotFoundStatus) |
|
71 | - $this->not_found_props = $propstat['prop']; |
|
77 | + if ($propstat['status'] == AbstractCalDAVResponse::HttpNotFoundStatus) { |
|
78 | + $this->not_found_props = $propstat['prop']; |
|
79 | + } |
|
72 | 80 | } |
73 | 81 | return $this; |
74 | 82 | } |
@@ -69,8 +69,9 @@ |
||
69 | 69 | ) |
70 | 70 | ]; |
71 | 71 | |
72 | - if(!empty($this->vo->getDescription())) |
|
73 | - $props['{urn:ietf:params:xml:ns:caldav}calendar-description'] = $this->vo->getDescription(); |
|
72 | + if(!empty($this->vo->getDescription())) { |
|
73 | + $props['{urn:ietf:params:xml:ns:caldav}calendar-description'] = $this->vo->getDescription(); |
|
74 | + } |
|
74 | 75 | |
75 | 76 | return $service->write('{urn:ietf:params:xml:ns:caldav}mkcalendar', |
76 | 77 | [ |
@@ -47,10 +47,11 @@ |
||
47 | 47 | $dt = new DateTime($trans['time'], new DateTimeZone('UTC')); |
48 | 48 | $hours = abs($former_offset); |
49 | 49 | // START TIME IS ON UTC and should be converted to local using former offset |
50 | - if($former_offset >= 0 ) |
|
51 | - $dt->add(new DateInterval("PT{$hours}H")); |
|
52 | - else |
|
53 | - $dt->sub(new DateInterval("PT{$hours}H")); |
|
50 | + if($former_offset >= 0 ) { |
|
51 | + $dt->add(new DateInterval("PT{$hours}H")); |
|
52 | + } else { |
|
53 | + $dt->sub(new DateInterval("PT{$hours}H")); |
|
54 | + } |
|
54 | 55 | |
55 | 56 | return $dt; |
56 | 57 | } |
@@ -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; |
@@ -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 | /** |
@@ -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; |
@@ -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(); |
@@ -50,8 +50,9 @@ |
||
50 | 50 | $this->stripped = $this->stripNamespacesFromTags($this->body); |
51 | 51 | // Merge CDATA as text nodes |
52 | 52 | $this->xml = simplexml_load_string($this->stripped, null, LIBXML_NOCDATA); |
53 | - if($this->xml === FALSE) |
|
54 | - throw new XMLResponseParseException(); |
|
53 | + if($this->xml === FALSE) { |
|
54 | + throw new XMLResponseParseException(); |
|
55 | + } |
|
55 | 56 | $this->content = $this->toAssocArray($this->xml); |
56 | 57 | |
57 | 58 | $this->parse(); |