@@ -51,27 +51,27 @@ discard block |
||
| 51 | 51 | case HttpMethods::Put: |
| 52 | 52 | |
| 53 | 53 | $len = $params[0]; |
| 54 | - $etag = $params[1]; |
|
| 54 | + $etag = $params[1]; |
|
| 55 | 55 | |
| 56 | - $headers = [ |
|
| 57 | - Headers::ContentLength => intval($len), |
|
| 58 | - Headers::ContentType => ContentTypes::Calendar, |
|
| 59 | - ]; |
|
| 56 | + $headers = [ |
|
| 57 | + Headers::ContentLength => intval($len), |
|
| 58 | + Headers::ContentType => ContentTypes::Calendar, |
|
| 59 | + ]; |
|
| 60 | 60 | |
| 61 | - if(!empty($etag)){ |
|
| 62 | - $headers[Headers::IfMatch] = $etag; |
|
| 63 | - } |
|
| 61 | + if(!empty($etag)){ |
|
| 62 | + $headers[Headers::IfMatch] = $etag; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - return $headers; |
|
| 65 | + return $headers; |
|
| 66 | 66 | } |
| 67 | 67 | return []; |
| 68 | 68 | } |
| 69 | 69 | /** |
| 70 | - * @param string $url |
|
| 71 | - * @param string $body |
|
| 72 | - * @param int $depth |
|
| 73 | - * @return Request |
|
| 74 | - */ |
|
| 70 | + * @param string $url |
|
| 71 | + * @param string $body |
|
| 72 | + * @param int $depth |
|
| 73 | + * @return Request |
|
| 74 | + */ |
|
| 75 | 75 | public static function createPropFindRequest($url , $body, $depth = 1){ |
| 76 | 76 | return new Request |
| 77 | 77 | ( |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string $etag |
| 161 | 161 | * @return Request |
| 162 | 162 | */ |
| 163 | - public static function createPutRequest($url, $body, $etag = null){ |
|
| 163 | + public static function createPutRequest($url, $body, $etag = null){ |
|
| 164 | 164 | |
| 165 | 165 | return new Request |
| 166 | 166 | ( |
@@ -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 | ]; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | Headers::ContentType => ContentTypes::Calendar, |
| 59 | 59 | ]; |
| 60 | 60 | |
| 61 | - if(!empty($etag)){ |
|
| 61 | + if (!empty($etag)) { |
|
| 62 | 62 | $headers[Headers::IfMatch] = $etag; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -72,11 +72,10 @@ discard block |
||
| 72 | 72 | * @param int $depth |
| 73 | 73 | * @return Request |
| 74 | 74 | */ |
| 75 | - public static function createPropFindRequest($url , $body, $depth = 1){ |
|
| 76 | - return new Request |
|
| 77 | - ( |
|
| 75 | + public static function createPropFindRequest($url, $body, $depth = 1) { |
|
| 76 | + return new Request( |
|
| 78 | 77 | HttpMethods::PropFind, |
| 79 | - $url , |
|
| 78 | + $url, |
|
| 80 | 79 | self::createHeadersFor(HttpMethods::PropFind, [$depth]), |
| 81 | 80 | $body |
| 82 | 81 | ); |
@@ -87,9 +86,8 @@ discard block |
||
| 87 | 86 | * @param string $body |
| 88 | 87 | * @return Request |
| 89 | 88 | */ |
| 90 | - public static function createMakeCalendarRequest($url , $body){ |
|
| 91 | - return new Request |
|
| 92 | - ( |
|
| 89 | + public static function createMakeCalendarRequest($url, $body) { |
|
| 90 | + return new Request( |
|
| 93 | 91 | HttpMethods::MakeCalendar, |
| 94 | 92 | $url, |
| 95 | 93 | self::createHeadersFor(HttpMethods::MakeCalendar), |
@@ -102,9 +100,8 @@ discard block |
||
| 102 | 100 | * @param int $depth |
| 103 | 101 | * @return Request |
| 104 | 102 | */ |
| 105 | - public static function createOptionsRequest($url, $depth = 1){ |
|
| 106 | - return new Request |
|
| 107 | - ( |
|
| 103 | + public static function createOptionsRequest($url, $depth = 1) { |
|
| 104 | + return new Request( |
|
| 108 | 105 | HttpMethods::Options, |
| 109 | 106 | $url, |
| 110 | 107 | self::createHeadersFor(HttpMethods::Options, [$depth]) |
@@ -117,9 +114,8 @@ discard block |
||
| 117 | 114 | * @param int $depth |
| 118 | 115 | * @return Request |
| 119 | 116 | */ |
| 120 | - public static function createReportRequest($url , $body, $depth = 1){ |
|
| 121 | - return new Request |
|
| 122 | - ( |
|
| 117 | + public static function createReportRequest($url, $body, $depth = 1) { |
|
| 118 | + return new Request( |
|
| 123 | 119 | HttpMethods::Report, |
| 124 | 120 | $url, |
| 125 | 121 | self::createHeadersFor(HttpMethods::Report, [$depth]), |
@@ -132,9 +128,8 @@ discard block |
||
| 132 | 128 | * @param string $etag |
| 133 | 129 | * @return Request |
| 134 | 130 | */ |
| 135 | - public static function createDeleteRequest($url , $etag){ |
|
| 136 | - return new Request |
|
| 137 | - ( |
|
| 131 | + public static function createDeleteRequest($url, $etag) { |
|
| 132 | + return new Request( |
|
| 138 | 133 | HttpMethods::Delete, |
| 139 | 134 | $url, |
| 140 | 135 | self::createHeadersFor(HttpMethods::Delete, [$etag]) |
@@ -145,9 +140,8 @@ discard block |
||
| 145 | 140 | * @param string $url |
| 146 | 141 | * @return Request |
| 147 | 142 | */ |
| 148 | - public static function createGetRequest($url){ |
|
| 149 | - return new Request |
|
| 150 | - ( |
|
| 143 | + public static function createGetRequest($url) { |
|
| 144 | + return new Request( |
|
| 151 | 145 | HttpMethods::Get, |
| 152 | 146 | $url, |
| 153 | 147 | self::createHeadersFor(HttpMethods::Get) |
@@ -160,10 +154,9 @@ discard block |
||
| 160 | 154 | * @param string $etag |
| 161 | 155 | * @return Request |
| 162 | 156 | */ |
| 163 | - public static function createPutRequest($url, $body, $etag = null){ |
|
| 157 | + public static function createPutRequest($url, $body, $etag = null) { |
|
| 164 | 158 | |
| 165 | - return new Request |
|
| 166 | - ( |
|
| 159 | + return new Request( |
|
| 167 | 160 | HttpMethods::Put, |
| 168 | 161 | $url, |
| 169 | 162 | self::createHeadersFor(HttpMethods::Put, [strlen($body), $etag]), |
@@ -177,9 +170,8 @@ discard block |
||
| 177 | 170 | * @param string $etag |
| 178 | 171 | * @return Request |
| 179 | 172 | */ |
| 180 | - public static function createPostRequest($url, $body, $etag = null){ |
|
| 181 | - return new Request |
|
| 182 | - ( |
|
| 173 | + public static function createPostRequest($url, $body, $etag = null) { |
|
| 174 | + return new Request( |
|
| 183 | 175 | HttpMethods::Post, |
| 184 | 176 | $url, |
| 185 | 177 | self::createHeadersFor(HttpMethods::Post, [$etag]), |