@@ -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 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | * @return CalDAVRequestFactory |
41 | 41 | */ |
42 | 42 | public static function getInstance(){ |
43 | - if(is_null(self::$instance)) self::$instance = new CalDAVRequestFactory(); |
|
43 | + if(is_null(self::$instance)) { |
|
44 | + self::$instance = new CalDAVRequestFactory(); |
|
45 | + } |
|
44 | 46 | return self::$instance; |
45 | 47 | } |
46 | 48 | |
@@ -61,28 +63,34 @@ discard block |
||
61 | 63 | case self::CalendarRequestType: |
62 | 64 | return new GetCalendarRequest(); |
63 | 65 | case self::CalendarSyncRequestType: |
64 | - if(count($params) == 0 ) |
|
65 | - throw new \InvalidArgumentException(); |
|
66 | + if(count($params) == 0 ) { |
|
67 | + throw new \InvalidArgumentException(); |
|
68 | + } |
|
66 | 69 | return new CalendarSyncRequest($params[0]); |
67 | 70 | case self::CalendarMultiGetRequestType: |
68 | - if(count($params) == 0 ) |
|
69 | - throw new \InvalidArgumentException(); |
|
71 | + if(count($params) == 0 ) { |
|
72 | + throw new \InvalidArgumentException(); |
|
73 | + } |
|
70 | 74 | return new CalendarMultiGetRequest($params[0]); |
71 | 75 | case self::CalendarQueryRequestType: |
72 | - if(count($params) == 0 ) |
|
73 | - throw new \InvalidArgumentException(); |
|
76 | + if(count($params) == 0 ) { |
|
77 | + throw new \InvalidArgumentException(); |
|
78 | + } |
|
74 | 79 | return new CalendarQueryRequest($params[0]); |
75 | 80 | case self::CalendarCreateRequestType: |
76 | - if(count($params) == 0 ) |
|
77 | - throw new \InvalidArgumentException(); |
|
81 | + if(count($params) == 0 ) { |
|
82 | + throw new \InvalidArgumentException(); |
|
83 | + } |
|
78 | 84 | return new CalendarCreateRequest($params[0]); |
79 | 85 | case self::EventCreateRequestType: |
80 | - if(count($params) == 0 ) |
|
81 | - throw new \InvalidArgumentException(); |
|
86 | + if(count($params) == 0 ) { |
|
87 | + throw new \InvalidArgumentException(); |
|
88 | + } |
|
82 | 89 | return new EventCreateRequest($params[0]); |
83 | 90 | case self::EventUpdateRequestType: |
84 | - if(count($params) == 0 ) |
|
85 | - throw new \InvalidArgumentException(); |
|
91 | + if(count($params) == 0 ) { |
|
92 | + throw new \InvalidArgumentException(); |
|
93 | + } |
|
86 | 94 | return new EventUpdateRequest($params[0]); |
87 | 95 | } |
88 | 96 | return null; |
@@ -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 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | public function getUpdates(){ |
41 | 41 | $res = []; |
42 | 42 | foreach ($this->responses as $entity){ |
43 | - if($entity->getStatus() != HttpResponse::HttpOKStatus) continue; |
|
43 | + if($entity->getStatus() != HttpResponse::HttpOKStatus) { |
|
44 | + continue; |
|
45 | + } |
|
44 | 46 | $res[] = $entity; |
45 | 47 | } |
46 | 48 | return $res; |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | public function getDeletes(){ |
53 | 55 | $res = []; |
54 | 56 | foreach ($this->responses as $entity){ |
55 | - if($entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue; |
|
57 | + if($entity->getStatus() != HttpResponse::HttpNotFoundStatus) { |
|
58 | + continue; |
|
59 | + } |
|
56 | 60 | $res[] = $entity; |
57 | 61 | } |
58 | 62 | return $res; |
@@ -46,8 +46,9 @@ |
||
46 | 46 | $this->server_url = $server_url; |
47 | 47 | if(!empty($this->body)) { |
48 | 48 | $this->xml = simplexml_load_string($this->body, 'SimpleXMLElement', LIBXML_NOCDATA); |
49 | - if($this->xml === FALSE) |
|
50 | - throw new XMLResponseParseException(); |
|
49 | + if($this->xml === FALSE) { |
|
50 | + throw new XMLResponseParseException(); |
|
51 | + } |
|
51 | 52 | $this->content = $this->toAssocArray($this->xml); |
52 | 53 | $this->parse(); |
53 | 54 | } |
@@ -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 | } |
@@ -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(); |