@@ -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 | } |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | <?php |
3 | 3 | |
4 | 4 | $sourceDirectory = $argv[1]; |
5 | -$sourceDirectory = rtrim($sourceDirectory, '/') . '/'; |
|
5 | +$sourceDirectory = rtrim($sourceDirectory, '/').'/'; |
|
6 | 6 | |
7 | 7 | if (!str_starts_with('/', $sourceDirectory)) { |
8 | - $sourceDirectory = getcwd() . '/' . $sourceDirectory; |
|
8 | + $sourceDirectory = getcwd().'/'.$sourceDirectory; |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $stripNamespacePrefix = $argv[2] ?? ''; |
@@ -18,39 +18,39 @@ discard block |
||
18 | 18 | exit(1); |
19 | 19 | } |
20 | 20 | $organizationList = []; |
21 | -foreach(scandir($sourceDirectory) as $file) { |
|
22 | - if (!is_dir($sourceDirectory . $file) || $file === '.' || $file === '..') { |
|
21 | +foreach (scandir($sourceDirectory) as $file) { |
|
22 | + if (!is_dir($sourceDirectory.$file) || $file === '.' || $file === '..') { |
|
23 | 23 | continue; |
24 | 24 | } |
25 | - $organizationList[] = $sourceDirectory . $file . '/'; |
|
25 | + $organizationList[] = $sourceDirectory.$file.'/'; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $projectList = []; |
29 | -foreach($organizationList as $organizationDir) { |
|
30 | - foreach(scandir($organizationDir) as $file) { |
|
31 | - if (!is_dir($organizationDir . $file) || $file === '.' || $file === '..') { |
|
29 | +foreach ($organizationList as $organizationDir) { |
|
30 | + foreach (scandir($organizationDir) as $file) { |
|
31 | + if (!is_dir($organizationDir.$file) || $file === '.' || $file === '..') { |
|
32 | 32 | continue; |
33 | 33 | } |
34 | - $projectList[] = $organizationDir . $file . '/'; |
|
34 | + $projectList[] = $organizationDir.$file.'/'; |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | 38 | $knownDestination = []; |
39 | 39 | foreach ($projectList as $projectDir) { |
40 | - if (!file_exists($projectDir . 'composer.json')) { |
|
40 | + if (!file_exists($projectDir.'composer.json')) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | - $projectInfo = json_decode(file_get_contents($projectDir . 'composer.json'), true); |
|
44 | + $projectInfo = json_decode(file_get_contents($projectDir.'composer.json'), true); |
|
45 | 45 | if (!isset($projectInfo['autoload']['psr-4'])) { |
46 | - printf("No supported autoload configuration in %s" . PHP_EOL, $projectDir); |
|
46 | + printf("No supported autoload configuration in %s".PHP_EOL, $projectDir); |
|
47 | 47 | exit(2); |
48 | 48 | } |
49 | 49 | foreach ($projectInfo['autoload']['psr-4'] as $namespace => $codeDir) { |
50 | 50 | if ($stripNamespacePrefix !== '' && strpos($namespace, $stripNamespacePrefix) === 0) { |
51 | 51 | $namespace = str_replace($stripNamespacePrefix, '', $namespace); |
52 | 52 | } |
53 | - $destination = rtrim($sourceDirectory, '/') . str_replace('\\', '/', $namespace); |
|
53 | + $destination = rtrim($sourceDirectory, '/').str_replace('\\', '/', $namespace); |
|
54 | 54 | |
55 | 55 | if (!in_array($destination, $knownDestination)) { |
56 | 56 | if (file_exists($destination)) { |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | $knownDestination[] = $destination; |
61 | 61 | } |
62 | 62 | |
63 | - if (!rename_or_move($projectDir . $codeDir, $destination)) { |
|
64 | - printf("Failed to move %s to %s" . PHP_EOL, $projectDir . $codeDir, $destination); |
|
63 | + if (!rename_or_move($projectDir.$codeDir, $destination)) { |
|
64 | + printf("Failed to move %s to %s".PHP_EOL, $projectDir.$codeDir, $destination); |
|
65 | 65 | exit(3); |
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | -foreach($organizationList as $organizationDir) { |
|
70 | +foreach ($organizationList as $organizationDir) { |
|
71 | 71 | rmdir_recursive($organizationDir); |
72 | 72 | } |
73 | 73 | |
74 | 74 | function rmdir_recursive($dir) { |
75 | - foreach(scandir($dir) as $file) { |
|
75 | + foreach (scandir($dir) as $file) { |
|
76 | 76 | if ('.' === $file || '..' === $file) { |
77 | 77 | continue; |
78 | 78 | } |
@@ -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 | } |