@@ -126,12 +126,12 @@ |
||
126 | 126 | $hosts = $this->configService->getElasticHost(); |
127 | 127 | foreach ($hosts as $host) { |
128 | 128 | $parsedHost = parse_url($host); |
129 | - $safeHost = $parsedHost['scheme'] . '://'; |
|
129 | + $safeHost = $parsedHost['scheme'].'://'; |
|
130 | 130 | if (array_key_exists('user', $parsedHost)) { |
131 | - $safeHost .= $parsedHost['user'] . ':' . '********' . '@'; |
|
131 | + $safeHost .= $parsedHost['user'].':'.'********'.'@'; |
|
132 | 132 | } |
133 | 133 | $safeHost .= $parsedHost['host']; |
134 | - $safeHost .= ':' . $parsedHost['port']; |
|
134 | + $safeHost .= ':'.$parsedHost['port']; |
|
135 | 135 | |
136 | 136 | $sanitizedHosts[] = $safeHost; |
137 | 137 | } |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ->setHosts($hosts) |
396 | 396 | ->setRetries(3); |
397 | 397 | |
398 | - $this->configureAuthentication($cb, $hosts); |
|
398 | + $this->configureAuthentication($cb, $hosts); |
|
399 | 399 | |
400 | 400 | $this->client = $cb->build(); |
401 | 401 | } catch (Exception $e) { |
@@ -403,20 +403,20 @@ discard block |
||
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | - /** |
|
407 | - * setBasicAuthentication() on ClientBuilder if available, using list of hosts |
|
408 | - */ |
|
409 | - private function configureAuthentication(ClientBuilder $cb, array $hosts): void { |
|
410 | - foreach ($hosts as $host) { |
|
411 | - $user = parse_url($host, PHP_URL_USER) ?? ''; |
|
412 | - $pass = parse_url($host, PHP_URL_PASS) ?? ''; |
|
413 | - |
|
414 | - if ($user !== '' || $pass !== '') { |
|
415 | - $cb->setBasicAuthentication($user, $pass); |
|
416 | - return; |
|
417 | - } |
|
418 | - } |
|
419 | - } |
|
406 | + /** |
|
407 | + * setBasicAuthentication() on ClientBuilder if available, using list of hosts |
|
408 | + */ |
|
409 | + private function configureAuthentication(ClientBuilder $cb, array $hosts): void { |
|
410 | + foreach ($hosts as $host) { |
|
411 | + $user = parse_url($host, PHP_URL_USER) ?? ''; |
|
412 | + $pass = parse_url($host, PHP_URL_PASS) ?? ''; |
|
413 | + |
|
414 | + if ($user !== '' || $pass !== '') { |
|
415 | + $cb->setBasicAuthentication($user, $pass); |
|
416 | + return; |
|
417 | + } |
|
418 | + } |
|
419 | + } |
|
420 | 420 | |
421 | 421 | |
422 | 422 | /** |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | foreach ($keys as $key) { |
405 | 405 | if (!array_key_exists($key, $arr)) { |
406 | 406 | throw new MalformedArrayException( |
407 | - 'source: ' . json_encode($arr) . ' - missing key: ' . $key |
|
407 | + 'source: '.json_encode($arr).' - missing key: '.$key |
|
408 | 408 | ); |
409 | 409 | } |
410 | 410 | } |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | protected function cleanArray(array &$arr) { |
418 | 418 | $arr = array_filter( |
419 | 419 | $arr, |
420 | - function ($v) { |
|
420 | + function($v) { |
|
421 | 421 | if (is_string($v)) { |
422 | 422 | return ($v !== ''); |
423 | 423 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'index' => |
68 | 68 | [ |
69 | 69 | 'index' => $this->configService->getElasticIndex(), |
70 | - 'id' => $document->getProviderId() . ':' . $document->getId(), |
|
70 | + 'id' => $document->getProviderId().':'.$document->getId(), |
|
71 | 71 | 'body' => $this->generateIndexBody($document) |
72 | 72 | ] |
73 | 73 | ]; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'index' => |
96 | 96 | [ |
97 | 97 | 'index' => $this->configService->getElasticIndex(), |
98 | - 'id' => $document->getProviderId() . ':' . $document->getId(), |
|
98 | + 'id' => $document->getProviderId().':'.$document->getId(), |
|
99 | 99 | 'body' => ['doc' => $this->generateIndexBody($document)] |
100 | 100 | ] |
101 | 101 | ]; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | 'index' => |
126 | 126 | [ |
127 | 127 | 'index' => $this->configService->getElasticIndex(), |
128 | - 'id' => $providerId . ':' . $documentId, |
|
128 | + 'id' => $providerId.':'.$documentId, |
|
129 | 129 | ] |
130 | 130 | ]; |
131 | 131 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | use OCP\AppFramework\Bootstrap\IBootstrap; |
35 | 35 | use OCP\AppFramework\Bootstrap\IRegistrationContext; |
36 | 36 | |
37 | -require_once __DIR__ . '/../../vendor/autoload.php'; |
|
37 | +require_once __DIR__.'/../../vendor/autoload.php'; |
|
38 | 38 | |
39 | 39 | class Application extends App implements IBootstrap { |
40 | 40 |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | class SearchMappingService { |
50 | 50 | |
51 | - public function __construct |
|
52 | - ( |
|
51 | + public function __construct( |
|
53 | 52 | private ConfigService $configService |
54 | 53 | ) { |
55 | 54 | } |
@@ -275,7 +274,7 @@ discard block |
||
275 | 274 | |
276 | 275 | foreach ($request->getWildcardFields() as $field) { |
277 | 276 | if (!$this->fieldIsOutLimit($request, $field)) { |
278 | - $queryFields[] = ['wildcard' => [$field => '*' . $content->getWord() . '*']]; |
|
277 | + $queryFields[] = ['wildcard' => [$field => '*'.$content->getWord().'*']]; |
|
279 | 278 | } |
280 | 279 | } |
281 | 280 | |
@@ -439,7 +438,7 @@ discard block |
||
439 | 438 | public function getDocumentQuery(string $providerId, string $documentId): array { |
440 | 439 | return [ |
441 | 440 | 'index' => $this->configService->getElasticIndex(), |
442 | - 'id' => $providerId . ':' . $documentId |
|
441 | + 'id' => $providerId.':'.$documentId |
|
443 | 442 | ]; |
444 | 443 | } |
445 | 444 | |
@@ -451,8 +450,8 @@ discard block |
||
451 | 450 | */ |
452 | 451 | private function getPartsFields(ISearchRequest $request): array { |
453 | 452 | return array_map( |
454 | - function (string $value): string { |
|
455 | - return 'parts.' . $value; |
|
453 | + function(string $value): string { |
|
454 | + return 'parts.'.$value; |
|
456 | 455 | }, $request->getParts() |
457 | 456 | ); |
458 | 457 | } |