@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | break; |
51 | 51 | case HttpMethods::Put: |
52 | 52 | $etag = $params[0]; |
53 | - if(empty($etag)){ |
|
54 | - return [ |
|
55 | - Headers::ContentType => ContentTypes::Calendar, |
|
56 | - Headers::IfNotMatch => '*', |
|
57 | - ]; |
|
58 | - } |
|
59 | - return [ |
|
60 | - Headers::ContentType => ContentTypes::Calendar, |
|
61 | - Headers::IfMatch => $etag |
|
62 | - ]; |
|
53 | + if(empty($etag)){ |
|
54 | + return [ |
|
55 | + Headers::ContentType => ContentTypes::Calendar, |
|
56 | + Headers::IfNotMatch => '*', |
|
57 | + ]; |
|
58 | + } |
|
59 | + return [ |
|
60 | + Headers::ContentType => ContentTypes::Calendar, |
|
61 | + Headers::IfMatch => $etag |
|
62 | + ]; |
|
63 | 63 | break; |
64 | 64 | } |
65 | 65 | return []; |
66 | 66 | } |
67 | 67 | /** |
68 | - * @param string $url |
|
69 | - * @param string $body |
|
70 | - * @param int $depth |
|
71 | - * @return Request |
|
72 | - */ |
|
68 | + * @param string $url |
|
69 | + * @param string $body |
|
70 | + * @param int $depth |
|
71 | + * @return Request |
|
72 | + */ |
|
73 | 73 | public static function createPropFindRequest($url , $body, $depth = 1){ |
74 | 74 | return new Request |
75 | 75 | ( |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @param string $etag |
159 | 159 | * @return Request |
160 | 160 | */ |
161 | - public static function createPutRequest($url, $body, $etag = null){ |
|
161 | + public static function createPutRequest($url, $body, $etag = null){ |
|
162 | 162 | return new Request |
163 | 163 | ( |
164 | 164 | HttpMethods::Put, |
@@ -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: |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | break; |
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 => '*', |
@@ -70,11 +70,10 @@ discard block |
||
70 | 70 | * @param int $depth |
71 | 71 | * @return Request |
72 | 72 | */ |
73 | - public static function createPropFindRequest($url , $body, $depth = 1){ |
|
74 | - return new Request |
|
75 | - ( |
|
73 | + public static function createPropFindRequest($url, $body, $depth = 1) { |
|
74 | + return new Request( |
|
76 | 75 | HttpMethods::PropFind, |
77 | - $url , |
|
76 | + $url, |
|
78 | 77 | self::createHeadersFor(HttpMethods::PropFind, [$depth]), |
79 | 78 | $body |
80 | 79 | ); |
@@ -85,9 +84,8 @@ discard block |
||
85 | 84 | * @param string $body |
86 | 85 | * @return Request |
87 | 86 | */ |
88 | - public static function createMakeCalendarRequest($url , $body){ |
|
89 | - return new Request |
|
90 | - ( |
|
87 | + public static function createMakeCalendarRequest($url, $body) { |
|
88 | + return new Request( |
|
91 | 89 | HttpMethods::MakeCalendar, |
92 | 90 | $url, |
93 | 91 | self::createHeadersFor(HttpMethods::MakeCalendar), |
@@ -100,9 +98,8 @@ discard block |
||
100 | 98 | * @param int $depth |
101 | 99 | * @return Request |
102 | 100 | */ |
103 | - public static function createOptionsRequest($url, $depth = 1){ |
|
104 | - return new Request |
|
105 | - ( |
|
101 | + public static function createOptionsRequest($url, $depth = 1) { |
|
102 | + return new Request( |
|
106 | 103 | HttpMethods::Options, |
107 | 104 | $url, |
108 | 105 | self::createHeadersFor(HttpMethods::Options, [$depth]) |
@@ -115,9 +112,8 @@ discard block |
||
115 | 112 | * @param int $depth |
116 | 113 | * @return Request |
117 | 114 | */ |
118 | - public static function createReportRequest($url , $body, $depth = 1){ |
|
119 | - return new Request |
|
120 | - ( |
|
115 | + public static function createReportRequest($url, $body, $depth = 1) { |
|
116 | + return new Request( |
|
121 | 117 | HttpMethods::Report, |
122 | 118 | $url, |
123 | 119 | self::createHeadersFor(HttpMethods::Report, [$depth]), |
@@ -130,9 +126,8 @@ discard block |
||
130 | 126 | * @param string $etag |
131 | 127 | * @return Request |
132 | 128 | */ |
133 | - public static function createDeleteRequest($url , $etag){ |
|
134 | - return new Request |
|
135 | - ( |
|
129 | + public static function createDeleteRequest($url, $etag) { |
|
130 | + return new Request( |
|
136 | 131 | HttpMethods::Delete, |
137 | 132 | $url, |
138 | 133 | self::createHeadersFor(HttpMethods::Delete, [$etag]) |
@@ -143,9 +138,8 @@ discard block |
||
143 | 138 | * @param string $url |
144 | 139 | * @return Request |
145 | 140 | */ |
146 | - public static function createGetRequest($url){ |
|
147 | - return new Request |
|
148 | - ( |
|
141 | + public static function createGetRequest($url) { |
|
142 | + return new Request( |
|
149 | 143 | HttpMethods::Get, |
150 | 144 | $url, |
151 | 145 | self::createHeadersFor(HttpMethods::Get) |
@@ -158,9 +152,8 @@ discard block |
||
158 | 152 | * @param string $etag |
159 | 153 | * @return Request |
160 | 154 | */ |
161 | - public static function createPutRequest($url, $body, $etag = null){ |
|
162 | - return new Request |
|
163 | - ( |
|
155 | + public static function createPutRequest($url, $body, $etag = null) { |
|
156 | + return new Request( |
|
164 | 157 | HttpMethods::Put, |
165 | 158 | $url, |
166 | 159 | self::createHeadersFor(HttpMethods::Put, [$etag]), |