Completed
Push — master ( 9df998...698146 )
by
unknown
18:00 queued 15s
created
apps/dav/lib/Files/FileSearchBackend.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 				default => SearchPropertyDefinition::DATATYPE_STRING
118 118
 			};
119 119
 			$metadataProps[] = new SearchPropertyDefinition(
120
-				FilesPlugin::FILE_METADATA_PREFIX . $key,
120
+				FilesPlugin::FILE_METADATA_PREFIX.$key,
121 121
 				true,
122 122
 				$isIndex,
123 123
 				$isIndex,
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 							new SearchComparison(
192 192
 								ISearchComparison::COMPARE_LIKE,
193 193
 								'path',
194
-								$internalPath . '/%',
194
+								$internalPath.'/%',
195 195
 								''
196 196
 							),
197 197
 						]
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		}
206 206
 
207 207
 		/** @var SearchResult[] $nodes */
208
-		$nodes = array_map(function (Node $node) {
208
+		$nodes = array_map(function(Node $node) {
209 209
 			if ($node instanceof Folder) {
210 210
 				$davNode = new Directory($this->view, $node, $this->tree, $this->shareManager);
211 211
 			} else {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
 		if (!$query->limitToHome()) {
220 220
 			// Sort again, since the result from multiple storages is appended and not sorted
221
-			usort($nodes, function (SearchResult $a, SearchResult $b) use ($search) {
221
+			usort($nodes, function(SearchResult $a, SearchResult $b) use ($search) {
222 222
 				return $this->sort($a, $b, $search->orderBy);
223 223
 			});
224 224
 		}
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 	 * @return string
309 309
 	 */
310 310
 	private function getHrefForNode(Node $node) {
311
-		$base = '/files/' . $this->user->getUID();
312
-		return $base . $this->view->getRelativePath($node->getPath());
311
+		$base = '/files/'.$this->user->getUID();
312
+		return $base.$this->view->getRelativePath($node->getPath());
313 313
 	}
314 314
 
315 315
 	/**
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return ISearchQuery
319 319
 	 */
320 320
 	private function transformQuery(Query $query, ?SearchBinaryOperator $scopeOperators = null): ISearchQuery {
321
-		$orders = array_map(function (Order $order): ISearchOrder {
321
+		$orders = array_map(function(Order $order): ISearchOrder {
322 322
 			$direction = $order->order === Order::ASC ? ISearchOrder::DIRECTION_ASCENDING : ISearchOrder::DIRECTION_DESCENDING;
323 323
 			if (str_starts_with($order->property->name, FilesPlugin::FILE_METADATA_PREFIX)) {
324 324
 				return new SearchOrder($direction, substr($order->property->name, strlen(FilesPlugin::FILE_METADATA_PREFIX)), IMetadataQuery::EXTRA);
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
 		$operatorCount = $this->countSearchOperators($query->where);
344 344
 		if ($operatorCount > self::OPERATOR_LIMIT) {
345
-			throw new \InvalidArgumentException('Invalid search query, maximum operator limit of ' . self::OPERATOR_LIMIT . ' exceeded, got ' . $operatorCount . ' operators');
345
+			throw new \InvalidArgumentException('Invalid search query, maximum operator limit of '.self::OPERATOR_LIMIT.' exceeded, got '.$operatorCount.' operators');
346 346
 		}
347 347
 
348 348
 		/** @var SearchBinaryOperator|SearchComparison */
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 
356 356
 		return new SearchQuery(
357 357
 			$operators,
358
-			(int)$limit->maxResults,
358
+			(int) $limit->maxResults,
359 359
 			$offset,
360 360
 			$orders,
361 361
 			$this->user,
@@ -402,16 +402,16 @@  discard block
 block discarded – undo
402 402
 			case Operator::OPERATION_LESS_THAN:
403 403
 			case Operator::OPERATION_IS_LIKE:
404 404
 				if (count($operator->arguments) !== 2) {
405
-					throw new \InvalidArgumentException('Invalid number of arguments for ' . $trimmedType . ' operation');
405
+					throw new \InvalidArgumentException('Invalid number of arguments for '.$trimmedType.' operation');
406 406
 				}
407 407
 				if (!($operator->arguments[1] instanceof Literal)) {
408
-					throw new \InvalidArgumentException('Invalid argument 2 for ' . $trimmedType . ' operation, expected literal');
408
+					throw new \InvalidArgumentException('Invalid argument 2 for '.$trimmedType.' operation, expected literal');
409 409
 				}
410 410
 				$value = $operator->arguments[1]->value;
411 411
 				// no break
412 412
 			case Operator::OPERATION_IS_DEFINED:
413 413
 				if (!($operator->arguments[0] instanceof SearchPropertyDefinition)) {
414
-					throw new \InvalidArgumentException('Invalid argument 1 for ' . $trimmedType . ' operation, expected property');
414
+					throw new \InvalidArgumentException('Invalid argument 1 for '.$trimmedType.' operation, expected property');
415 415
 				}
416 416
 				$property = $operator->arguments[0];
417 417
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 				try {
426 426
 					$castedValue = $this->castValue($property, $value ?? '');
427 427
 				} catch (\Error $e) {
428
-					throw new \InvalidArgumentException('Invalid property value for ' . $property->name, previous: $e);
428
+					throw new \InvalidArgumentException('Invalid property value for '.$property->name, previous: $e);
429 429
 				}
430 430
 
431 431
 				return new SearchComparison(
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			case Operator::OPERATION_IS_COLLECTION:
439 439
 				return new SearchComparison('eq', 'mimetype', ICacheEntry::DIRECTORY_MIMETYPE);
440 440
 			default:
441
-				throw new \InvalidArgumentException('Unsupported operation ' . $trimmedType . ' (' . $operator->type . ')');
441
+				throw new \InvalidArgumentException('Unsupported operation '.$trimmedType.' ('.$operator->type.')');
442 442
 		}
443 443
 	}
444 444
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 			case FilesPlugin::INTERNAL_FILEID_PROPERTYNAME:
464 464
 				return 'fileid';
465 465
 			default:
466
-				throw new \InvalidArgumentException('Unsupported property for search or order: ' . $property->name);
466
+				throw new \InvalidArgumentException('Unsupported property for search or order: '.$property->name);
467 467
 		}
468 468
 	}
469 469
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 				if (is_numeric($value)) {
484 484
 					return max(0, 0 + $value);
485 485
 				}
486
-				$date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, (string)$value);
486
+				$date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, (string) $value);
487 487
 				return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0;
488 488
 			default:
489 489
 				return $value;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * Get a specific property from the were clause
495 495
 	 */
496
-	private function extractWhereValue(Operator &$operator, string $propertyName, string $comparison, bool $acceptableLocation = true): ?string {
496
+	private function extractWhereValue(Operator & $operator, string $propertyName, string $comparison, bool $acceptableLocation = true): ?string {
497 497
 		switch ($operator->type) {
498 498
 			case Operator::OPERATION_AND:
499 499
 			case Operator::OPERATION_OR:
Please login to merge, or discard this patch.