@@ -69,10 +69,11 @@ |
||
69 | 69 | $offset = $trans['offset'] / 3600; |
70 | 70 | // DATETIME S |
71 | 71 | $hours = abs($former_offset); |
72 | - if($former_offset >= 0 ) |
|
73 | - $dt->add(new DateInterval("PT{$hours}H")); |
|
74 | - else |
|
75 | - $dt->sub(new DateInterval("PT{$hours}H")); |
|
72 | + if($former_offset >= 0 ) { |
|
73 | + $dt->add(new DateInterval("PT{$hours}H")); |
|
74 | + } else { |
|
75 | + $dt->sub(new DateInterval("PT{$hours}H")); |
|
76 | + } |
|
76 | 77 | $current_time_zone_rule->setDtStart($dt); |
77 | 78 | $current_time_zone_rule->setTzOffsetFrom(sprintf('%s%02d%02d', $former_offset >= 0 ? '+' : '-', abs($former_offset), abs(($former_offset - floor($former_offset)) * 60))); |
78 | 79 | $current_time_zone_rule->setTzOffsetTo(sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs($offset), abs(($offset - floor($offset)) * 60))); |
@@ -21,11 +21,11 @@ |
||
21 | 21 | final class RequestFactory |
22 | 22 | { |
23 | 23 | /** |
24 | - * @param string $url |
|
25 | - * @param string $body |
|
26 | - * @param int $depth |
|
27 | - * @return Request |
|
28 | - */ |
|
24 | + * @param string $url |
|
25 | + * @param string $body |
|
26 | + * @param int $depth |
|
27 | + * @return Request |
|
28 | + */ |
|
29 | 29 | static function createPropFindRequest($url , $body, $depth = 1){ |
30 | 30 | return new Request('PROPFIND', $url , [ |
31 | 31 | 'Depth' => $depth, |
@@ -111,8 +111,7 @@ |
||
111 | 111 | |
112 | 112 | if(empty($etag)){ |
113 | 113 | $headers["If-None-Match"] = "*"; |
114 | - } |
|
115 | - else{ |
|
114 | + } else{ |
|
116 | 115 | $headers["If-Match"] = $etag; |
117 | 116 | } |
118 | 117 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | |
60 | 60 | if($time_zone->getName() == 'UTC'){ |
61 | 61 | $event->setUseUtc(true) |
62 | - ->setUseTimezone(false); |
|
62 | + ->setUseTimezone(false); |
|
63 | 63 | } |
64 | 64 | else{ |
65 | 65 | $event->setUseUtc(false) |
@@ -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 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | public function __construct(){ |
23 | 23 | $this->properties = [ |
24 | - '{DAV:}current-user-principal' |
|
24 | + '{DAV:}current-user-principal' |
|
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function getContent() |
39 | 39 | { |
40 | - $service = new Service(); |
|
40 | + $service = new Service(); |
|
41 | 41 | |
42 | 42 | $service->namespaceMap = [ |
43 | 43 | 'DAV:' => 'D', |
@@ -69,8 +69,9 @@ |
||
69 | 69 | ) |
70 | 70 | ]; |
71 | 71 | |
72 | - if(!empty($this->dto->getDescription())) |
|
73 | - $props['{urn:ietf:params:xml:ns:caldav}calendar-description'] = $this->dto->getDescription(); |
|
72 | + if(!empty($this->dto->getDescription())) { |
|
73 | + $props['{urn:ietf:params:xml:ns:caldav}calendar-description'] = $this->dto->getDescription(); |
|
74 | + } |
|
74 | 75 | |
75 | 76 | return $service->write('{urn:ietf:params:xml:ns:caldav}mkcalendar', |
76 | 77 | [ |
@@ -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; |
@@ -46,8 +46,8 @@ |
||
46 | 46 | /** |
47 | 47 | * As indicated in Section 3.10 of [RFC2445], the URL of calendar object |
48 | 48 | * resources containing (an arbitrary set of) calendaring and scheduling |
49 | - * information may be suffixed by ".ics", and the URL of calendar object |
|
50 | - * resources containing free or busy time information may be suffixed by |
|
49 | + * information may be suffixed by ".ics", and the URL of calendar object |
|
50 | + * resources containing free or busy time information may be suffixed by |
|
51 | 51 | ".ifb". |
52 | 52 | */ |
53 | 53 |
@@ -130,8 +130,7 @@ |
||
130 | 130 | 'auth' => [$this->user, $this->password], |
131 | 131 | 'timeout' => $this->timeout |
132 | 132 | ]); |
133 | - } |
|
134 | - catch (ClientException $ex){ |
|
133 | + } catch (ClientException $ex){ |
|
135 | 134 | switch($ex->getCode()){ |
136 | 135 | case 401: |
137 | 136 | throw new UserUnAuthorizedException(); |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | 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 | 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; |