@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | * @param DateTimeZone $time_zone |
32 | 32 | * @return array |
33 | 33 | */ |
34 | - private static function calculateTimeRangeForTransitions(DateTimeZone $time_zone){ |
|
34 | + private static function calculateTimeRangeForTransitions(DateTimeZone $time_zone) { |
|
35 | 35 | |
36 | 36 | $now = new DateTime('now', $time_zone); |
37 | 37 | $year = $now->format('Y'); |
38 | - return [new DateTime('1/1/'.$year, $time_zone), new DateTime('1/1/'.($year + 1), $time_zone)]; |
|
38 | + return [new DateTime('1/1/'.$year, $time_zone), new DateTime('1/1/'.($year + 1), $time_zone)]; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | * @param int $former_offset |
44 | 44 | * @return DateTime |
45 | 45 | */ |
46 | - private static function convertStartDateFromUTC2Local(array $trans, $former_offset){ |
|
46 | + private static function convertStartDateFromUTC2Local(array $trans, $former_offset) { |
|
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 ) |
|
50 | + if ($former_offset >= 0) |
|
51 | 51 | $dt->add(new DateInterval("PT{$hours}H")); |
52 | 52 | else |
53 | 53 | $dt->sub(new DateInterval("PT{$hours}H")); |
@@ -59,12 +59,11 @@ discard block |
||
59 | 59 | * @param DateTime $dt |
60 | 60 | * @return RecurrenceRule |
61 | 61 | */ |
62 | - private static function calculateRecurrenceRule(DateTime $dt){ |
|
63 | - $r_rule = new RecurrenceRule(); |
|
62 | + private static function calculateRecurrenceRule(DateTime $dt) { |
|
63 | + $r_rule = new RecurrenceRule(); |
|
64 | 64 | $r_rule->setFreq(RecurrenceRule::FREQ_YEARLY); |
65 | 65 | $r_rule->setByMonth(intval($dt->format('m'))); |
66 | - $r_rule->setByDay |
|
67 | - ( |
|
66 | + $r_rule->setByDay( |
|
68 | 67 | self::translate2ByDay($dt) |
69 | 68 | ); |
70 | 69 | return $r_rule; |
@@ -74,7 +73,7 @@ discard block |
||
74 | 73 | * @param $offset |
75 | 74 | * @return string |
76 | 75 | */ |
77 | - private static function calculateOffsetFrom($offset){ |
|
76 | + private static function calculateOffsetFrom($offset) { |
|
78 | 77 | return sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs($offset), abs(($offset - floor($offset)) * 60)); |
79 | 78 | } |
80 | 79 | |
@@ -82,7 +81,7 @@ discard block |
||
82 | 81 | * @param $offset |
83 | 82 | * @return string |
84 | 83 | */ |
85 | - private static function calculateOffsetTo($offset){ |
|
84 | + private static function calculateOffsetTo($offset) { |
|
86 | 85 | return sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs($offset), abs(($offset - floor($offset)) * 60)); |
87 | 86 | } |
88 | 87 | /** |
@@ -91,7 +90,7 @@ discard block |
||
91 | 90 | * @param bool $with_calendar_envelope |
92 | 91 | * @return Calendar|Timezone |
93 | 92 | */ |
94 | - public static function build(DateTimeZone $time_zone, $calendar_prod_id, $with_calendar_envelope = true){ |
|
93 | + public static function build(DateTimeZone $time_zone, $calendar_prod_id, $with_calendar_envelope = true) { |
|
95 | 94 | |
96 | 95 | // get all transitions for one current year and next |
97 | 96 | list($start_range, $end_range) = self::calculateTimeRangeForTransitions($time_zone); |
@@ -111,11 +110,11 @@ discard block |
||
111 | 110 | |
112 | 111 | // daylight saving time definition |
113 | 112 | if ($trans['isdst']) { |
114 | - $current_time_zone_rule = new TimezoneRule(TimezoneRule::TYPE_DAYLIGHT);; |
|
113 | + $current_time_zone_rule = new TimezoneRule(TimezoneRule::TYPE_DAYLIGHT); ; |
|
115 | 114 | } |
116 | 115 | // standard time definition |
117 | 116 | else { |
118 | - $current_time_zone_rule = new TimezoneRule(TimezoneRule::TYPE_STANDARD);; |
|
117 | + $current_time_zone_rule = new TimezoneRule(TimezoneRule::TYPE_STANDARD); ; |
|
119 | 118 | } |
120 | 119 | |
121 | 120 | if ($current_time_zone_rule) { |
@@ -136,7 +135,7 @@ discard block |
||
136 | 135 | } |
137 | 136 | |
138 | 137 | } |
139 | - if($with_calendar_envelope) { |
|
138 | + if ($with_calendar_envelope) { |
|
140 | 139 | $vCalendar = new Calendar(sprintf("'-//%s//EN'", $calendar_prod_id)); |
141 | 140 | $vCalendar->setTimezone($vTimezone); |
142 | 141 | return $vCalendar; |
@@ -156,25 +155,25 @@ discard block |
||
156 | 155 | * @param DateTime $dt) |
157 | 156 | * @return string |
158 | 157 | */ |
159 | - private static function translate2ByDay(DateTime $dt){ |
|
160 | - $day_name = substr(strtoupper($dt->format('D')), 0,2); |
|
158 | + private static function translate2ByDay(DateTime $dt) { |
|
159 | + $day_name = substr(strtoupper($dt->format('D')), 0, 2); |
|
161 | 160 | $ordinals = ['first', 'second', 'third', 'fourth', 'last']; |
162 | 161 | $day_nbr = 0; |
163 | 162 | $is_last = false; |
164 | 163 | |
165 | - foreach($ordinals as $idx => $ord){ |
|
164 | + foreach ($ordinals as $idx => $ord) { |
|
166 | 165 | $dt_n = self::buildOrdinalDateTime($ord, $dt); |
167 | - if($dt_n->format('Y-m-d') == $dt->format('Y-m-d')){ |
|
168 | - $day_nbr = $idx + 1; |
|
169 | - if($ord == 'last'){ |
|
166 | + if ($dt_n->format('Y-m-d') == $dt->format('Y-m-d')) { |
|
167 | + $day_nbr = $idx + 1; |
|
168 | + if ($ord == 'last') { |
|
170 | 169 | $is_last = true; |
171 | - $day_nbr = 1; |
|
170 | + $day_nbr = 1; |
|
172 | 171 | } |
173 | 172 | break; |
174 | 173 | } |
175 | 174 | } |
176 | 175 | |
177 | - return sprintf('%s%s%s', $is_last? '-':'', $day_nbr, $day_name); |
|
176 | + return sprintf('%s%s%s', $is_last ? '-' : '', $day_nbr, $day_name); |
|
178 | 177 | } |
179 | 178 | |
180 | 179 | /** |
@@ -182,15 +181,11 @@ discard block |
||
182 | 181 | * @param DateTime $dt |
183 | 182 | * @return DateTime |
184 | 183 | */ |
185 | - private static function buildOrdinalDateTime($ord, DateTime $dt){ |
|
186 | - return new DateTime |
|
187 | - ( |
|
188 | - date |
|
189 | - ("Y-m-d", |
|
190 | - strtotime |
|
191 | - ( |
|
192 | - sprintf |
|
193 | - ( |
|
184 | + private static function buildOrdinalDateTime($ord, DateTime $dt) { |
|
185 | + return new DateTime( |
|
186 | + date("Y-m-d", |
|
187 | + strtotime( |
|
188 | + sprintf( |
|
194 | 189 | self::GetOrdinalDayQuery, |
195 | 190 | $ord, |
196 | 191 | $dt->format('l'), |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | protected function parse() |
27 | 27 | { |
28 | - if(isset($this->content['response'])){ |
|
28 | + if (isset($this->content['response'])) { |
|
29 | 29 | |
30 | - if(isset($this->content['response']['propstat'])) { |
|
30 | + if (isset($this->content['response']['propstat'])) { |
|
31 | 31 | // its a collection with one single element |
32 | 32 | $single_resource = $this->buildSingleResponse(); |
33 | 33 | $single_resource->setContent(['response' => $this->content['response']]); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @return GenericSinglePROPFINDCalDAVResponse[] |
50 | 50 | */ |
51 | - public function getResponses(){ |
|
51 | + public function getResponses() { |
|
52 | 52 | return $this->responses; |
53 | 53 | } |
54 | 54 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | /** |
22 | 22 | * @return string |
23 | 23 | */ |
24 | - public function getVCard(){ |
|
24 | + public function getVCard() { |
|
25 | 25 | return isset($this->found_props['calendar-data']) ? $this->found_props['calendar-data'] : null; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | /** |
22 | 22 | * @return bool |
23 | 23 | */ |
24 | - public function isSuccessFull(){ |
|
24 | + public function isSuccessFull() { |
|
25 | 25 | return $this->code == HttpResponse::HttpCodeNoContent; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -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::IfNotMatch => '*', |
@@ -69,11 +69,10 @@ discard block |
||
69 | 69 | * @param int $depth |
70 | 70 | * @return Request |
71 | 71 | */ |
72 | - public static function createPropFindRequest($url , $body, $depth = 1){ |
|
73 | - return new Request |
|
74 | - ( |
|
72 | + public static function createPropFindRequest($url, $body, $depth = 1) { |
|
73 | + return new Request( |
|
75 | 74 | HttpMethods::PropFind, |
76 | - $url , |
|
75 | + $url, |
|
77 | 76 | self::createHeadersFor(HttpMethods::PropFind, [$depth]), |
78 | 77 | $body |
79 | 78 | ); |
@@ -84,9 +83,8 @@ discard block |
||
84 | 83 | * @param string $body |
85 | 84 | * @return Request |
86 | 85 | */ |
87 | - public static function createMakeCalendarRequest($url , $body){ |
|
88 | - return new Request |
|
89 | - ( |
|
86 | + public static function createMakeCalendarRequest($url, $body) { |
|
87 | + return new Request( |
|
90 | 88 | HttpMethods::MakeCalendar, |
91 | 89 | $url, |
92 | 90 | self::createHeadersFor(HttpMethods::MakeCalendar), |
@@ -99,9 +97,8 @@ discard block |
||
99 | 97 | * @param int $depth |
100 | 98 | * @return Request |
101 | 99 | */ |
102 | - public static function createOptionsRequest($url, $depth = 1){ |
|
103 | - return new Request |
|
104 | - ( |
|
100 | + public static function createOptionsRequest($url, $depth = 1) { |
|
101 | + return new Request( |
|
105 | 102 | HttpMethods::Options, |
106 | 103 | $url, |
107 | 104 | self::createHeadersFor(HttpMethods::Options, [$depth]) |
@@ -114,9 +111,8 @@ discard block |
||
114 | 111 | * @param int $depth |
115 | 112 | * @return Request |
116 | 113 | */ |
117 | - public static function createReportRequest($url , $body, $depth = 1){ |
|
118 | - return new Request |
|
119 | - ( |
|
114 | + public static function createReportRequest($url, $body, $depth = 1) { |
|
115 | + return new Request( |
|
120 | 116 | HttpMethods::Report, |
121 | 117 | $url, |
122 | 118 | self::createHeadersFor(HttpMethods::Report, [$depth]), |
@@ -129,9 +125,8 @@ discard block |
||
129 | 125 | * @param string $etag |
130 | 126 | * @return Request |
131 | 127 | */ |
132 | - public static function createDeleteRequest($url , $etag){ |
|
133 | - return new Request |
|
134 | - ( |
|
128 | + public static function createDeleteRequest($url, $etag) { |
|
129 | + return new Request( |
|
135 | 130 | HttpMethods::Delete, |
136 | 131 | $url, |
137 | 132 | self::createHeadersFor(HttpMethods::Delete, [$etag]) |
@@ -142,9 +137,8 @@ discard block |
||
142 | 137 | * @param string $url |
143 | 138 | * @return Request |
144 | 139 | */ |
145 | - public static function createGetRequest($url){ |
|
146 | - return new Request |
|
147 | - ( |
|
140 | + public static function createGetRequest($url) { |
|
141 | + return new Request( |
|
148 | 142 | HttpMethods::Get, |
149 | 143 | $url, |
150 | 144 | self::createHeadersFor(HttpMethods::Get) |
@@ -157,9 +151,8 @@ discard block |
||
157 | 151 | * @param string $etag |
158 | 152 | * @return Request |
159 | 153 | */ |
160 | - public static function createPutRequest($url, $body, $etag = null){ |
|
161 | - return new Request |
|
162 | - ( |
|
154 | + public static function createPutRequest($url, $body, $etag = null) { |
|
155 | + return new Request( |
|
163 | 156 | HttpMethods::Put, |
164 | 157 | $url, |
165 | 158 | self::createHeadersFor(HttpMethods::Put, [$etag]), |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | * @param Request $http_request |
126 | 126 | * @return mixed|\Psr\Http\Message\ResponseInterface |
127 | 127 | */ |
128 | - private function makeRequest(Request $http_request){ |
|
129 | - try{ |
|
128 | + private function makeRequest(Request $http_request) { |
|
129 | + try { |
|
130 | 130 | return $this->client->send($http_request, [ |
131 | 131 | 'auth' => [$this->user, $this->password], |
132 | 132 | 'timeout' => $this->timeout |
133 | 133 | ]); |
134 | 134 | } |
135 | - catch (ClientException $ex){ |
|
136 | - switch($ex->getCode()){ |
|
135 | + catch (ClientException $ex) { |
|
136 | + switch ($ex->getCode()) { |
|
137 | 137 | case 401: |
138 | 138 | throw new UserUnAuthorizedException(); |
139 | 139 | break; |
@@ -161,9 +161,9 @@ discard block |
||
161 | 161 | |
162 | 162 | $res = $http_response->hasHeader(self::DAVHeader); |
163 | 163 | $options = []; |
164 | - if($res){ |
|
164 | + if ($res) { |
|
165 | 165 | $val = $http_response->getHeaderLine(self::DAVHeader); |
166 | - if(!empty($val)){ |
|
166 | + if (!empty($val)) { |
|
167 | 167 | $options = explode(', ', $val); |
168 | 168 | } |
169 | 169 | } |
@@ -177,14 +177,13 @@ discard block |
||
177 | 177 | public function getUserPrincipal() |
178 | 178 | { |
179 | 179 | $http_response = $this->makeRequest( |
180 | - RequestFactory::createPropFindRequest |
|
181 | - ( |
|
180 | + RequestFactory::createPropFindRequest( |
|
182 | 181 | $this->server_url, |
183 | 182 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::PrincipalRequestType)->getContent() |
184 | 183 | ) |
185 | 184 | ); |
186 | 185 | |
187 | - return new UserPrincipalResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
186 | + return new UserPrincipalResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
188 | 187 | } |
189 | 188 | |
190 | 189 | /** |
@@ -194,14 +193,13 @@ discard block |
||
194 | 193 | public function getCalendarHome($principal_url) |
195 | 194 | { |
196 | 195 | $http_response = $this->makeRequest( |
197 | - RequestFactory::createPropFindRequest |
|
198 | - ( |
|
196 | + RequestFactory::createPropFindRequest( |
|
199 | 197 | $principal_url, |
200 | 198 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarHomeRequestType)->getContent() |
201 | 199 | ) |
202 | 200 | ); |
203 | 201 | |
204 | - return new CalendarHomesResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
202 | + return new CalendarHomesResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
205 | 203 | } |
206 | 204 | |
207 | 205 | /** |
@@ -215,8 +213,7 @@ discard block |
||
215 | 213 | $uid = $vo->getUID(); |
216 | 214 | $resource_url = $calendar_home_set.$uid; |
217 | 215 | $http_response = $this->makeRequest( |
218 | - RequestFactory::createMakeCalendarRequest |
|
219 | - ( |
|
216 | + RequestFactory::createMakeCalendarRequest( |
|
220 | 217 | $resource_url, |
221 | 218 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarCreateRequestType, [$vo])->getContent() |
222 | 219 | ) |
@@ -232,14 +229,13 @@ discard block |
||
232 | 229 | public function getCalendars($calendar_home_set_url) |
233 | 230 | { |
234 | 231 | $http_response = $this->makeRequest( |
235 | - RequestFactory::createPropFindRequest |
|
236 | - ( |
|
232 | + RequestFactory::createPropFindRequest( |
|
237 | 233 | $calendar_home_set_url, |
238 | 234 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarsRequestType)->getContent() |
239 | 235 | ) |
240 | 236 | ); |
241 | 237 | |
242 | - return new GetCalendarsResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
238 | + return new GetCalendarsResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
243 | 239 | } |
244 | 240 | |
245 | 241 | /** |
@@ -249,15 +245,14 @@ discard block |
||
249 | 245 | public function getCalendar($calendar_url) |
250 | 246 | { |
251 | 247 | $http_response = $this->makeRequest( |
252 | - RequestFactory::createPropFindRequest |
|
253 | - ( |
|
248 | + RequestFactory::createPropFindRequest( |
|
254 | 249 | $calendar_url, |
255 | 250 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarRequestType)->getContent(), |
256 | 251 | 0 |
257 | 252 | ) |
258 | 253 | ); |
259 | 254 | |
260 | - return new GetCalendarResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
255 | + return new GetCalendarResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
261 | 256 | } |
262 | 257 | |
263 | 258 | |
@@ -270,14 +265,13 @@ discard block |
||
270 | 265 | { |
271 | 266 | |
272 | 267 | $http_response = $this->makeRequest( |
273 | - RequestFactory::createReportRequest |
|
274 | - ( |
|
268 | + RequestFactory::createReportRequest( |
|
275 | 269 | $calendar_url, |
276 | 270 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarSyncRequestType, [$sync_token])->getContent() |
277 | 271 | ) |
278 | 272 | ); |
279 | 273 | |
280 | - return new CalendarSyncInfoResponse($this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode()); |
|
274 | + return new CalendarSyncInfoResponse($this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode()); |
|
281 | 275 | } |
282 | 276 | |
283 | 277 | /** |
@@ -290,19 +284,17 @@ discard block |
||
290 | 284 | $uid = $vo->getUID(); |
291 | 285 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
292 | 286 | $http_response = $this->makeRequest( |
293 | - RequestFactory::createPutRequest |
|
294 | - ( |
|
287 | + RequestFactory::createPutRequest( |
|
295 | 288 | $resource_url, |
296 | 289 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventCreateRequestType, [$vo])->getContent() |
297 | 290 | ) |
298 | 291 | ); |
299 | 292 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
300 | - return new EventCreatedResponse |
|
301 | - ( |
|
293 | + return new EventCreatedResponse( |
|
302 | 294 | $uid, |
303 | 295 | $etag, |
304 | 296 | $resource_url, |
305 | - (string)$http_response->getBody(), |
|
297 | + (string) $http_response->getBody(), |
|
306 | 298 | $http_response->getStatusCode() |
307 | 299 | ); |
308 | 300 | } |
@@ -318,20 +310,18 @@ discard block |
||
318 | 310 | $uid = $vo->getUID(); |
319 | 311 | $resource_url = $calendar_url.$uid.self::SchedulingInformationSuffix; |
320 | 312 | $http_response = $this->makeRequest( |
321 | - RequestFactory::createPutRequest |
|
322 | - ( |
|
313 | + RequestFactory::createPutRequest( |
|
323 | 314 | $resource_url, |
324 | 315 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::EventUpdateRequestType, [$vo])->getContent(), |
325 | 316 | $etag |
326 | 317 | ) |
327 | 318 | ); |
328 | 319 | $etag = $http_response->hasHeader(self::ETagHeader) ? $http_response->getHeaderLine(self::ETagHeader) : null; |
329 | - return new EventUpdatedResponse |
|
330 | - ( |
|
320 | + return new EventUpdatedResponse( |
|
331 | 321 | $uid, |
332 | 322 | $etag, |
333 | 323 | $resource_url, |
334 | - (string)$http_response->getBody(), |
|
324 | + (string) $http_response->getBody(), |
|
335 | 325 | $http_response->getStatusCode() |
336 | 326 | ); |
337 | 327 | } |
@@ -345,16 +335,14 @@ discard block |
||
345 | 335 | public function deleteEvent($calendar_url, $uid, $etag) |
346 | 336 | { |
347 | 337 | $http_response = $this->makeRequest( |
348 | - RequestFactory::createDeleteRequest |
|
349 | - ( |
|
338 | + RequestFactory::createDeleteRequest( |
|
350 | 339 | $calendar_url.$uid.self::SchedulingInformationSuffix, |
351 | 340 | $etag |
352 | 341 | ) |
353 | 342 | ); |
354 | 343 | |
355 | - return new EventDeletedResponse |
|
356 | - ( |
|
357 | - $this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode() |
|
344 | + return new EventDeletedResponse( |
|
345 | + $this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode() |
|
358 | 346 | ); |
359 | 347 | } |
360 | 348 | |
@@ -362,15 +350,14 @@ discard block |
||
362 | 350 | * @param string $event_url |
363 | 351 | * @return string |
364 | 352 | */ |
365 | - public function getEventVCardBy($event_url){ |
|
353 | + public function getEventVCardBy($event_url) { |
|
366 | 354 | $http_response = $this->makeRequest( |
367 | - RequestFactory::createGetRequest |
|
368 | - ( |
|
355 | + RequestFactory::createGetRequest( |
|
369 | 356 | $event_url |
370 | 357 | ) |
371 | 358 | ); |
372 | 359 | |
373 | - $ical = (string)$http_response->getBody(); |
|
360 | + $ical = (string) $http_response->getBody(); |
|
374 | 361 | return $ical; |
375 | 362 | } |
376 | 363 | |
@@ -382,17 +369,15 @@ discard block |
||
382 | 369 | public function getEventsBy($calendar_url, array $events_urls) |
383 | 370 | { |
384 | 371 | $http_response = $this->makeRequest( |
385 | - RequestFactory::createReportRequest |
|
386 | - ( |
|
372 | + RequestFactory::createReportRequest( |
|
387 | 373 | $calendar_url, |
388 | 374 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarMultiGetRequestType, [$events_urls])->getContent() |
389 | 375 | ) |
390 | 376 | ); |
391 | 377 | |
392 | - return new ResourceCollectionResponse |
|
393 | - ( |
|
378 | + return new ResourceCollectionResponse( |
|
394 | 379 | $this->server_url, |
395 | - (string)$http_response->getBody(), |
|
380 | + (string) $http_response->getBody(), |
|
396 | 381 | $http_response->getStatusCode() |
397 | 382 | ); |
398 | 383 | } |
@@ -406,17 +391,15 @@ discard block |
||
406 | 391 | { |
407 | 392 | |
408 | 393 | $http_response = $this->makeRequest( |
409 | - RequestFactory::createReportRequest |
|
410 | - ( |
|
394 | + RequestFactory::createReportRequest( |
|
411 | 395 | $calendar_url, |
412 | 396 | CalDAVRequestFactory::getInstance()->build(CalDAVRequestFactory::CalendarQueryRequestType, [$filter])->getContent() |
413 | 397 | ) |
414 | 398 | ); |
415 | 399 | |
416 | - return new ResourceCollectionResponse |
|
417 | - ( |
|
400 | + return new ResourceCollectionResponse( |
|
418 | 401 | $this->server_url, |
419 | - (string)$http_response->getBody(), |
|
402 | + (string) $http_response->getBody(), |
|
420 | 403 | $http_response->getStatusCode() |
421 | 404 | ); |
422 | 405 | } |
@@ -429,16 +412,14 @@ discard block |
||
429 | 412 | public function deleteCalendar($calendar_url, $etag = null) |
430 | 413 | { |
431 | 414 | $http_response = $this->makeRequest( |
432 | - RequestFactory::createDeleteRequest |
|
433 | - ( |
|
415 | + RequestFactory::createDeleteRequest( |
|
434 | 416 | $calendar_url, |
435 | 417 | $etag |
436 | 418 | ) |
437 | 419 | ); |
438 | 420 | |
439 | - return new CalendarDeletedResponse |
|
440 | - ( |
|
441 | - $this->server_url, (string)$http_response->getBody(), $http_response->getStatusCode() |
|
421 | + return new CalendarDeletedResponse( |
|
422 | + $this->server_url, (string) $http_response->getBody(), $http_response->getStatusCode() |
|
442 | 423 | ); |
443 | 424 | } |
444 | 425 | } |
445 | 426 | \ No newline at end of file |
@@ -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 |