@@ -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 | } |
@@ -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 |
@@ -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 | } |
@@ -145,7 +145,7 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | return $this->config->getSystemValueString( |
148 | - Application::APP_NAME . '.' . $key, |
|
148 | + Application::APP_NAME.'.'.$key, |
|
149 | 149 | (string)$this->config->getAppValue(Application::APP_NAME, $key, $defaultValue) |
150 | 150 | ); |
151 | 151 | } |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | // Don't redefine the functions if included multiple times. |
6 | 6 | if (!\function_exists('OCA\\FullTextSearch_Elasticsearch\\Vendor\\GuzzleHttp\\describe_type')) { |
7 | - require __DIR__ . '/functions.php'; |
|
7 | + require __DIR__.'/functions.php'; |
|
8 | 8 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | if (empty($options['allow_redirects']['max'])) { |
53 | 53 | return $fn($request, $options); |
54 | 54 | } |
55 | - return $fn($request, $options)->then(function (ResponseInterface $response) use($request, $options) { |
|
55 | + return $fn($request, $options)->then(function(ResponseInterface $response) use($request, $options) { |
|
56 | 56 | return $this->checkRedirect($request, $options, $response); |
57 | 57 | }); |
58 | 58 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) |
63 | 63 | { |
64 | - if (\strpos((string) $response->getStatusCode(), '3') !== 0 || !$response->hasHeader('Location')) { |
|
64 | + if (\strpos((string)$response->getStatusCode(), '3') !== 0 || !$response->hasHeader('Location')) { |
|
65 | 65 | return $response; |
66 | 66 | } |
67 | 67 | $this->guardMax($request, $response, $options); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $promise = $this($nextRequest, $options); |
77 | 77 | // Add headers to be able to track history of redirects. |
78 | 78 | if (!empty($options['allow_redirects']['track_redirects'])) { |
79 | - return $this->withTracking($promise, (string) $nextRequest->getUri(), $response->getStatusCode()); |
|
79 | + return $this->withTracking($promise, (string)$nextRequest->getUri(), $response->getStatusCode()); |
|
80 | 80 | } |
81 | 81 | return $promise; |
82 | 82 | } |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | */ |
86 | 86 | private function withTracking(PromiseInterface $promise, string $uri, int $statusCode) : PromiseInterface |
87 | 87 | { |
88 | - return $promise->then(static function (ResponseInterface $response) use($uri, $statusCode) { |
|
88 | + return $promise->then(static function(ResponseInterface $response) use($uri, $statusCode) { |
|
89 | 89 | // Note that we are pushing to the front of the list as this |
90 | 90 | // would be an earlier response than what is currently present |
91 | 91 | // in the history header. |
92 | 92 | $historyHeader = $response->getHeader(self::HISTORY_HEADER); |
93 | 93 | $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); |
94 | 94 | \array_unshift($historyHeader, $uri); |
95 | - \array_unshift($statusHeader, (string) $statusCode); |
|
95 | + \array_unshift($statusHeader, (string)$statusCode); |
|
96 | 96 | return $response->withHeader(self::HISTORY_HEADER, $historyHeader)->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); |
97 | 97 | }); |
98 | 98 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // add the header if we are not redirecting from https to http. |
137 | 137 | if ($options['allow_redirects']['referer'] && $modify['uri']->getScheme() === $request->getUri()->getScheme()) { |
138 | 138 | $uri = $request->getUri()->withUserInfo(''); |
139 | - $modify['set_headers']['Referer'] = (string) $uri; |
|
139 | + $modify['set_headers']['Referer'] = (string)$uri; |
|
140 | 140 | } else { |
141 | 141 | $modify['remove_headers'][] = 'Referer'; |
142 | 142 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } |
299 | 299 | if (isset($options['form_params'])) { |
300 | 300 | if (isset($options['multipart'])) { |
301 | - throw new InvalidArgumentException('You cannot use ' . 'form_params and multipart at the same time. Use the ' . 'form_params option if you want to send application/' . 'x-www-form-urlencoded requests, and the multipart ' . 'option to send multipart/form-data requests.'); |
|
301 | + throw new InvalidArgumentException('You cannot use '.'form_params and multipart at the same time. Use the '.'form_params option if you want to send application/'.'x-www-form-urlencoded requests, and the multipart '.'option to send multipart/form-data requests.'); |
|
302 | 302 | } |
303 | 303 | $options['body'] = \http_build_query($options['form_params'], '', '&'); |
304 | 304 | unset($options['form_params']); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | case 'basic': |
337 | 337 | // Ensure that we don't have the header in different case and set the new value. |
338 | 338 | $modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']); |
339 | - $modify['set_headers']['Authorization'] = 'Basic ' . \base64_encode("{$value[0]}:{$value[1]}"); |
|
339 | + $modify['set_headers']['Authorization'] = 'Basic '.\base64_encode("{$value[0]}:{$value[1]}"); |
|
340 | 340 | break; |
341 | 341 | case 'digest': |
342 | 342 | // @todo: Do not rely on curl |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | // Use a multipart/form-data POST if a Content-Type is not set. |
376 | 376 | // Ensure that we don't have the header in different case and set the new value. |
377 | 377 | $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); |
378 | - $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' . $request->getBody()->getBoundary(); |
|
378 | + $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='.$request->getBody()->getBoundary(); |
|
379 | 379 | } |
380 | 380 | // Merge in conditional headers if they are not present. |
381 | 381 | if (isset($options['_conditional'])) { |
@@ -397,6 +397,6 @@ discard block |
||
397 | 397 | */ |
398 | 398 | private function invalidBody() : InvalidArgumentException |
399 | 399 | { |
400 | - return new InvalidArgumentException('Passing in the "body" request ' . 'option as an array to send a request is not supported. ' . 'Please use the "form_params" request option to send a ' . 'application/x-www-form-urlencoded request, or the "multipart" ' . 'request option to send a multipart/form-data request.'); |
|
400 | + return new InvalidArgumentException('Passing in the "body" request '.'option as an array to send a request is not supported. '.'Please use the "form_params" request option to send a '.'application/x-www-form-urlencoded request, or the "multipart" '.'request option to send a multipart/form-data request.'); |
|
401 | 401 | } |
402 | 402 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $cache = []; |
70 | 70 | /** @var string */ |
71 | - return \preg_replace_callback('/{\\s*([A-Za-z_\\-\\.0-9]+)\\s*}/', function (array $matches) use($request, $response, $error, &$cache) { |
|
71 | + return \preg_replace_callback('/{\\s*([A-Za-z_\\-\\.0-9]+)\\s*}/', function(array $matches) use($request, $response, $error, &$cache) { |
|
72 | 72 | if (isset($cache[$matches[1]])) { |
73 | 73 | return $cache[$matches[1]]; |
74 | 74 | } |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $result = $response ? Psr7\Message::toString($response) : ''; |
82 | 82 | break; |
83 | 83 | case 'req_headers': |
84 | - $result = \trim($request->getMethod() . ' ' . $request->getRequestTarget()) . ' HTTP/' . $request->getProtocolVersion() . "\r\n" . $this->headers($request); |
|
84 | + $result = \trim($request->getMethod().' '.$request->getRequestTarget()).' HTTP/'.$request->getProtocolVersion()."\r\n".$this->headers($request); |
|
85 | 85 | break; |
86 | 86 | case 'res_headers': |
87 | - $result = $response ? \sprintf('HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase()) . "\r\n" . $this->headers($response) : 'NULL'; |
|
87 | + $result = $response ? \sprintf('HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase())."\r\n".$this->headers($response) : 'NULL'; |
|
88 | 88 | break; |
89 | 89 | case 'req_body': |
90 | 90 | $result = $request->getBody()->__toString(); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | { |
162 | 162 | $result = ''; |
163 | 163 | foreach ($message->getHeaders() as $name => $values) { |
164 | - $result .= $name . ': ' . \implode(', ', $values) . "\r\n"; |
|
164 | + $result .= $name.': '.\implode(', ', $values)."\r\n"; |
|
165 | 165 | } |
166 | 166 | return \trim($result); |
167 | 167 | } |