@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -12,131 +12,131 @@ |
||
12 | 12 | */ |
13 | 13 | trait LoggerTrait |
14 | 14 | { |
15 | - /** |
|
16 | - * System is unusable. |
|
17 | - * |
|
18 | - * @param string $message |
|
19 | - * @param array $context |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function emergency($message, array $context = array()) |
|
24 | - { |
|
25 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
26 | - } |
|
15 | + /** |
|
16 | + * System is unusable. |
|
17 | + * |
|
18 | + * @param string $message |
|
19 | + * @param array $context |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function emergency($message, array $context = array()) |
|
24 | + { |
|
25 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Action must be taken immediately. |
|
30 | - * |
|
31 | - * Example: Entire website down, database unavailable, etc. This should |
|
32 | - * trigger the SMS alerts and wake you up. |
|
33 | - * |
|
34 | - * @param string $message |
|
35 | - * @param array $context |
|
36 | - * |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function alert($message, array $context = array()) |
|
40 | - { |
|
41 | - $this->log(LogLevel::ALERT, $message, $context); |
|
42 | - } |
|
28 | + /** |
|
29 | + * Action must be taken immediately. |
|
30 | + * |
|
31 | + * Example: Entire website down, database unavailable, etc. This should |
|
32 | + * trigger the SMS alerts and wake you up. |
|
33 | + * |
|
34 | + * @param string $message |
|
35 | + * @param array $context |
|
36 | + * |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function alert($message, array $context = array()) |
|
40 | + { |
|
41 | + $this->log(LogLevel::ALERT, $message, $context); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Critical conditions. |
|
46 | - * |
|
47 | - * Example: Application component unavailable, unexpected exception. |
|
48 | - * |
|
49 | - * @param string $message |
|
50 | - * @param array $context |
|
51 | - * |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function critical($message, array $context = array()) |
|
55 | - { |
|
56 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
57 | - } |
|
44 | + /** |
|
45 | + * Critical conditions. |
|
46 | + * |
|
47 | + * Example: Application component unavailable, unexpected exception. |
|
48 | + * |
|
49 | + * @param string $message |
|
50 | + * @param array $context |
|
51 | + * |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function critical($message, array $context = array()) |
|
55 | + { |
|
56 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Runtime errors that do not require immediate action but should typically |
|
61 | - * be logged and monitored. |
|
62 | - * |
|
63 | - * @param string $message |
|
64 | - * @param array $context |
|
65 | - * |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function error($message, array $context = array()) |
|
69 | - { |
|
70 | - $this->log(LogLevel::ERROR, $message, $context); |
|
71 | - } |
|
59 | + /** |
|
60 | + * Runtime errors that do not require immediate action but should typically |
|
61 | + * be logged and monitored. |
|
62 | + * |
|
63 | + * @param string $message |
|
64 | + * @param array $context |
|
65 | + * |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function error($message, array $context = array()) |
|
69 | + { |
|
70 | + $this->log(LogLevel::ERROR, $message, $context); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Exceptional occurrences that are not errors. |
|
75 | - * |
|
76 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
77 | - * that are not necessarily wrong. |
|
78 | - * |
|
79 | - * @param string $message |
|
80 | - * @param array $context |
|
81 | - * |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - public function warning($message, array $context = array()) |
|
85 | - { |
|
86 | - $this->log(LogLevel::WARNING, $message, $context); |
|
87 | - } |
|
73 | + /** |
|
74 | + * Exceptional occurrences that are not errors. |
|
75 | + * |
|
76 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
77 | + * that are not necessarily wrong. |
|
78 | + * |
|
79 | + * @param string $message |
|
80 | + * @param array $context |
|
81 | + * |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + public function warning($message, array $context = array()) |
|
85 | + { |
|
86 | + $this->log(LogLevel::WARNING, $message, $context); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Normal but significant events. |
|
91 | - * |
|
92 | - * @param string $message |
|
93 | - * @param array $context |
|
94 | - * |
|
95 | - * @return void |
|
96 | - */ |
|
97 | - public function notice($message, array $context = array()) |
|
98 | - { |
|
99 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
100 | - } |
|
89 | + /** |
|
90 | + * Normal but significant events. |
|
91 | + * |
|
92 | + * @param string $message |
|
93 | + * @param array $context |
|
94 | + * |
|
95 | + * @return void |
|
96 | + */ |
|
97 | + public function notice($message, array $context = array()) |
|
98 | + { |
|
99 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Interesting events. |
|
104 | - * |
|
105 | - * Example: User logs in, SQL logs. |
|
106 | - * |
|
107 | - * @param string $message |
|
108 | - * @param array $context |
|
109 | - * |
|
110 | - * @return void |
|
111 | - */ |
|
112 | - public function info($message, array $context = array()) |
|
113 | - { |
|
114 | - $this->log(LogLevel::INFO, $message, $context); |
|
115 | - } |
|
102 | + /** |
|
103 | + * Interesting events. |
|
104 | + * |
|
105 | + * Example: User logs in, SQL logs. |
|
106 | + * |
|
107 | + * @param string $message |
|
108 | + * @param array $context |
|
109 | + * |
|
110 | + * @return void |
|
111 | + */ |
|
112 | + public function info($message, array $context = array()) |
|
113 | + { |
|
114 | + $this->log(LogLevel::INFO, $message, $context); |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * Detailed debug information. |
|
119 | - * |
|
120 | - * @param string $message |
|
121 | - * @param array $context |
|
122 | - * |
|
123 | - * @return void |
|
124 | - */ |
|
125 | - public function debug($message, array $context = array()) |
|
126 | - { |
|
127 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
128 | - } |
|
117 | + /** |
|
118 | + * Detailed debug information. |
|
119 | + * |
|
120 | + * @param string $message |
|
121 | + * @param array $context |
|
122 | + * |
|
123 | + * @return void |
|
124 | + */ |
|
125 | + public function debug($message, array $context = array()) |
|
126 | + { |
|
127 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * Logs with an arbitrary level. |
|
132 | - * |
|
133 | - * @param mixed $level |
|
134 | - * @param string $message |
|
135 | - * @param array $context |
|
136 | - * |
|
137 | - * @return void |
|
138 | - * |
|
139 | - * @throws \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
140 | - */ |
|
141 | - abstract public function log($level, $message, array $context = array()); |
|
130 | + /** |
|
131 | + * Logs with an arbitrary level. |
|
132 | + * |
|
133 | + * @param mixed $level |
|
134 | + * @param string $message |
|
135 | + * @param array $context |
|
136 | + * |
|
137 | + * @return void |
|
138 | + * |
|
139 | + * @throws \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
140 | + */ |
|
141 | + abstract public function log($level, $message, array $context = array()); |
|
142 | 142 | } |
@@ -10,8 +10,7 @@ |
||
10 | 10 | * reduce boilerplate code that a simple Logger that does the same thing with |
11 | 11 | * messages regardless of the error level has to implement. |
12 | 12 | */ |
13 | -trait LoggerTrait |
|
14 | -{ |
|
13 | +trait LoggerTrait { |
|
15 | 14 | /** |
16 | 15 | * System is unusable. |
17 | 16 | * |
@@ -19,107 +19,107 @@ |
||
19 | 19 | */ |
20 | 20 | interface LoggerInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * System is unusable. |
|
24 | - * |
|
25 | - * @param string $message |
|
26 | - * @param mixed[] $context |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function emergency($message, array $context = array()); |
|
22 | + /** |
|
23 | + * System is unusable. |
|
24 | + * |
|
25 | + * @param string $message |
|
26 | + * @param mixed[] $context |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function emergency($message, array $context = array()); |
|
31 | 31 | |
32 | - /** |
|
33 | - * Action must be taken immediately. |
|
34 | - * |
|
35 | - * Example: Entire website down, database unavailable, etc. This should |
|
36 | - * trigger the SMS alerts and wake you up. |
|
37 | - * |
|
38 | - * @param string $message |
|
39 | - * @param mixed[] $context |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function alert($message, array $context = array()); |
|
32 | + /** |
|
33 | + * Action must be taken immediately. |
|
34 | + * |
|
35 | + * Example: Entire website down, database unavailable, etc. This should |
|
36 | + * trigger the SMS alerts and wake you up. |
|
37 | + * |
|
38 | + * @param string $message |
|
39 | + * @param mixed[] $context |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function alert($message, array $context = array()); |
|
44 | 44 | |
45 | - /** |
|
46 | - * Critical conditions. |
|
47 | - * |
|
48 | - * Example: Application component unavailable, unexpected exception. |
|
49 | - * |
|
50 | - * @param string $message |
|
51 | - * @param mixed[] $context |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function critical($message, array $context = array()); |
|
45 | + /** |
|
46 | + * Critical conditions. |
|
47 | + * |
|
48 | + * Example: Application component unavailable, unexpected exception. |
|
49 | + * |
|
50 | + * @param string $message |
|
51 | + * @param mixed[] $context |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function critical($message, array $context = array()); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Runtime errors that do not require immediate action but should typically |
|
59 | - * be logged and monitored. |
|
60 | - * |
|
61 | - * @param string $message |
|
62 | - * @param mixed[] $context |
|
63 | - * |
|
64 | - * @return void |
|
65 | - */ |
|
66 | - public function error($message, array $context = array()); |
|
57 | + /** |
|
58 | + * Runtime errors that do not require immediate action but should typically |
|
59 | + * be logged and monitored. |
|
60 | + * |
|
61 | + * @param string $message |
|
62 | + * @param mixed[] $context |
|
63 | + * |
|
64 | + * @return void |
|
65 | + */ |
|
66 | + public function error($message, array $context = array()); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Exceptional occurrences that are not errors. |
|
70 | - * |
|
71 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
72 | - * that are not necessarily wrong. |
|
73 | - * |
|
74 | - * @param string $message |
|
75 | - * @param mixed[] $context |
|
76 | - * |
|
77 | - * @return void |
|
78 | - */ |
|
79 | - public function warning($message, array $context = array()); |
|
68 | + /** |
|
69 | + * Exceptional occurrences that are not errors. |
|
70 | + * |
|
71 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
72 | + * that are not necessarily wrong. |
|
73 | + * |
|
74 | + * @param string $message |
|
75 | + * @param mixed[] $context |
|
76 | + * |
|
77 | + * @return void |
|
78 | + */ |
|
79 | + public function warning($message, array $context = array()); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Normal but significant events. |
|
83 | - * |
|
84 | - * @param string $message |
|
85 | - * @param mixed[] $context |
|
86 | - * |
|
87 | - * @return void |
|
88 | - */ |
|
89 | - public function notice($message, array $context = array()); |
|
81 | + /** |
|
82 | + * Normal but significant events. |
|
83 | + * |
|
84 | + * @param string $message |
|
85 | + * @param mixed[] $context |
|
86 | + * |
|
87 | + * @return void |
|
88 | + */ |
|
89 | + public function notice($message, array $context = array()); |
|
90 | 90 | |
91 | - /** |
|
92 | - * Interesting events. |
|
93 | - * |
|
94 | - * Example: User logs in, SQL logs. |
|
95 | - * |
|
96 | - * @param string $message |
|
97 | - * @param mixed[] $context |
|
98 | - * |
|
99 | - * @return void |
|
100 | - */ |
|
101 | - public function info($message, array $context = array()); |
|
91 | + /** |
|
92 | + * Interesting events. |
|
93 | + * |
|
94 | + * Example: User logs in, SQL logs. |
|
95 | + * |
|
96 | + * @param string $message |
|
97 | + * @param mixed[] $context |
|
98 | + * |
|
99 | + * @return void |
|
100 | + */ |
|
101 | + public function info($message, array $context = array()); |
|
102 | 102 | |
103 | - /** |
|
104 | - * Detailed debug information. |
|
105 | - * |
|
106 | - * @param string $message |
|
107 | - * @param mixed[] $context |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public function debug($message, array $context = array()); |
|
103 | + /** |
|
104 | + * Detailed debug information. |
|
105 | + * |
|
106 | + * @param string $message |
|
107 | + * @param mixed[] $context |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public function debug($message, array $context = array()); |
|
112 | 112 | |
113 | - /** |
|
114 | - * Logs with an arbitrary level. |
|
115 | - * |
|
116 | - * @param mixed $level |
|
117 | - * @param string $message |
|
118 | - * @param mixed[] $context |
|
119 | - * |
|
120 | - * @return void |
|
121 | - * |
|
122 | - * @throws \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
123 | - */ |
|
124 | - public function log($level, $message, array $context = array()); |
|
113 | + /** |
|
114 | + * Logs with an arbitrary level. |
|
115 | + * |
|
116 | + * @param mixed $level |
|
117 | + * @param string $message |
|
118 | + * @param mixed[] $context |
|
119 | + * |
|
120 | + * @return void |
|
121 | + * |
|
122 | + * @throws \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
123 | + */ |
|
124 | + public function log($level, $message, array $context = array()); |
|
125 | 125 | } |
@@ -17,8 +17,7 @@ |
||
17 | 17 | * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md |
18 | 18 | * for the full interface specification. |
19 | 19 | */ |
20 | -interface LoggerInterface |
|
21 | -{ |
|
20 | +interface LoggerInterface { |
|
22 | 21 | /** |
23 | 22 | * System is unusable. |
24 | 23 | * |
@@ -7,12 +7,12 @@ |
||
7 | 7 | */ |
8 | 8 | class LogLevel |
9 | 9 | { |
10 | - const EMERGENCY = 'emergency'; |
|
11 | - const ALERT = 'alert'; |
|
12 | - const CRITICAL = 'critical'; |
|
13 | - const ERROR = 'error'; |
|
14 | - const WARNING = 'warning'; |
|
15 | - const NOTICE = 'notice'; |
|
16 | - const INFO = 'info'; |
|
17 | - const DEBUG = 'debug'; |
|
10 | + const EMERGENCY = 'emergency'; |
|
11 | + const ALERT = 'alert'; |
|
12 | + const CRITICAL = 'critical'; |
|
13 | + const ERROR = 'error'; |
|
14 | + const WARNING = 'warning'; |
|
15 | + const NOTICE = 'notice'; |
|
16 | + const INFO = 'info'; |
|
17 | + const DEBUG = 'debug'; |
|
18 | 18 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * Describes log levels. |
7 | 7 | */ |
8 | -class LogLevel |
|
9 | -{ |
|
8 | +class LogLevel { |
|
10 | 9 | const EMERGENCY = 'emergency'; |
11 | 10 | const ALERT = 'alert'; |
12 | 11 | const CRITICAL = 'critical'; |