@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | ]; |
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 | } |
64 | 64 | return []; |
65 | 65 | } |
66 | 66 | /** |
67 | - * @param string $url |
|
68 | - * @param string $body |
|
69 | - * @param int $depth |
|
70 | - * @return Request |
|
71 | - */ |
|
67 | + * @param string $url |
|
68 | + * @param string $body |
|
69 | + * @param int $depth |
|
70 | + * @return Request |
|
71 | + */ |
|
72 | 72 | public static function createPropFindRequest($url , $body, $depth = 1){ |
73 | 73 | return new Request |
74 | 74 | ( |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string $etag |
158 | 158 | * @return Request |
159 | 159 | */ |
160 | - public static function createPutRequest($url, $body, $etag = null){ |
|
160 | + public static function createPutRequest($url, $body, $etag = null){ |
|
161 | 161 | return new Request |
162 | 162 | ( |
163 | 163 | 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: |
@@ -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]), |