Passed
Push — master ( 93133b...c32f14 )
by Morris
18:46 queued 07:48
created
apps/dav/lib/BackgroundJob/RefreshWebcalJob.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		try {
99 99
 			/** @var \DateInterval $dateInterval */
100 100
 			$dateInterval = DateTimeParser::parseDuration($refreshrate);
101
-		} catch(InvalidDataException $ex) {
101
+		} catch (InvalidDataException $ex) {
102 102
 			$this->logger->logException($ex);
103 103
 			$this->logger->warning("Subscription $subscriptionId could not be refreshed, refreshrate in database is invalid");
104 104
 			return;
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 					continue;
165 165
 				}
166 166
 
167
-				$uri = $uid . '.ics';
167
+				$uri = $uid.'.ics';
168 168
 				$calendarData = $vObject->serialize();
169 169
 				try {
170 170
 					$this->calDavBackend->createCalendarObject($subscription['id'], $uri, $calendarData, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
171
-				} catch(BadRequest $ex) {
171
+				} catch (BadRequest $ex) {
172 172
 					$this->logger->logException($ex);
173 173
 				}
174 174
 			}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			}
180 180
 
181 181
 			$this->updateSubscription($subscription, $mutations);
182
-		} catch(ParseException $ex) {
182
+		} catch (ParseException $ex) {
183 183
 			$subscriptionId = $subscription['id'];
184 184
 
185 185
 			$this->logger->logException($ex);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		$latestLocation = null;
202 202
 
203 203
 		$handlerStack = HandlerStack::create();
204
-		$handlerStack->push(Middleware::mapRequest(function (RequestInterface $request) {
204
+		$handlerStack->push(Middleware::mapRequest(function(RequestInterface $request) {
205 205
 			return $request
206 206
 				->withHeader('Accept', 'text/calendar, application/calendar+json, application/calendar+xml')
207 207
 				->withHeader('User-Agent', 'Nextcloud Webcal Crawler');
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				return null;
244 244
 			}
245 245
 
246
-			if ((bool)filter_var($host, FILTER_VALIDATE_IP) && !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
246
+			if ((bool) filter_var($host, FILTER_VALIDATE_IP) && !filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
247 247
 				$this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules");
248 248
 				return null;
249 249
 			}
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 
273 273
 			$contentType = $response->getHeader('Content-Type');
274 274
 			$contentType = explode(';', $contentType, 2)[0];
275
-			switch($contentType) {
275
+			switch ($contentType) {
276 276
 				case 'application/calendar+json':
277 277
 					try {
278 278
 						$jCalendar = Reader::readJson($body, Reader::OPTION_FORGIVING);
279
-					} catch(\Exception $ex) {
279
+					} catch (\Exception $ex) {
280 280
 						// In case of a parsing error return null
281 281
 						$this->logger->debug("Subscription $subscriptionId could not be parsed");
282 282
 						return null;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 				case 'application/calendar+xml':
287 287
 					try {
288 288
 						$xCalendar = Reader::readXML($body);
289
-					} catch(\Exception $ex) {
289
+					} catch (\Exception $ex) {
290 290
 						// In case of a parsing error return null
291 291
 						$this->logger->debug("Subscription $subscriptionId could not be parsed");
292 292
 						return null;
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
 				default:
298 298
 					try {
299 299
 						$vCalendar = Reader::read($body);
300
-					} catch(\Exception $ex) {
300
+					} catch (\Exception $ex) {
301 301
 						// In case of a parsing error return null
302 302
 						$this->logger->debug("Subscription $subscriptionId could not be parsed");
303 303
 						return null;
304 304
 					}
305 305
 					return $vCalendar->serialize();
306 306
 			}
307
-		} catch(\Exception $ex) {
307
+		} catch (\Exception $ex) {
308 308
 			$this->logger->logException($ex);
309 309
 			$this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error");
310 310
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		// check if new refresh rate is even valid
386 386
 		try {
387 387
 			DateTimeParser::parseDuration($newRefreshrate);
388
-		} catch(InvalidDataException $ex) {
388
+		} catch (InvalidDataException $ex) {
389 389
 			return null;
390 390
 		}
391 391
 
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 		}
432 432
 
433 433
 		$host = $parsed['host'] ?? '';
434
-		$port = isset($parsed['port']) ? ':' . $parsed['port'] : '';
434
+		$port = isset($parsed['port']) ? ':'.$parsed['port'] : '';
435 435
 		$path = $parsed['path'] ?? '';
436
-		$query = isset($parsed['query']) ? '?' . $parsed['query'] : '';
437
-		$fragment = isset($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
436
+		$query = isset($parsed['query']) ? '?'.$parsed['query'] : '';
437
+		$fragment = isset($parsed['fragment']) ? '#'.$parsed['fragment'] : '';
438 438
 
439 439
 		$cleanURL = "$scheme://$host$port$path$query$fragment";
440 440
 		// parse_url is giving some weird results if no url and no :// is given,
Please login to merge, or discard this patch.