@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | if (is_string($record)) { |
| 89 | 89 | $record = ['message' => $record]; |
| 90 | 90 | } |
| 91 | - return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
| 91 | + return $this->hasRecordThatPasses(function($rec) use ($record) { |
|
| 92 | 92 | if ($rec['message'] !== $record['message']) { |
| 93 | 93 | return false; |
| 94 | 94 | } |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function hasRecordThatContains($message, $level) |
| 103 | 103 | { |
| 104 | - return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
| 104 | + return $this->hasRecordThatPasses(function($rec) use ($message) { |
|
| 105 | 105 | return strpos($rec['message'], $message) !== false; |
| 106 | 106 | }, $level); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function hasRecordThatMatches($regex, $level) |
| 110 | 110 | { |
| 111 | - return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
| 111 | + return $this->hasRecordThatPasses(function($rec) use ($regex) { |
|
| 112 | 112 | return preg_match($regex, $rec['message']) > 0; |
| 113 | 113 | }, $level); |
| 114 | 114 | } |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | public function __call($method, $args) |
| 130 | 130 | { |
| 131 | 131 | if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
| 132 | - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
| 132 | + $genericMethod = $matches[1].('Records' !== $matches[3] ? 'Record' : '').$matches[3]; |
|
| 133 | 133 | $level = strtolower($matches[2]); |
| 134 | 134 | if (method_exists($this, $genericMethod)) { |
| 135 | 135 | $args[] = $level; |
| 136 | 136 | return call_user_func_array([$this, $genericMethod], $args); |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
| 139 | + throw new \BadMethodCallException('Call to undefined method '.get_class($this).'::'.$method.'()'); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function reset() |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $event->stopPropagation(); |
| 192 | 192 | |
| 193 | 193 | $dispatcher = $composer->getEventDispatcher(); |
| 194 | - $disableScripts = !method_exists($dispatcher, 'setRunScripts') || !((array) $dispatcher)["\0*\0runScripts"]; |
|
| 194 | + $disableScripts = !method_exists($dispatcher, 'setRunScripts') || !((array)$dispatcher)["\0*\0runScripts"]; |
|
| 195 | 195 | $composer = Factory::create($event->getIO(), null, false, $disableScripts); |
| 196 | 196 | |
| 197 | 197 | /** @var Installer $installer */ |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $composer->getAutoloadGenerator() |
| 213 | 213 | ); |
| 214 | 214 | if (method_exists($installer, 'setPlatformRequirementFilter')) { |
| 215 | - $installer->setPlatformRequirementFilter(((array) $trace['object'])["\0*\0platformRequirementFilter"]); |
|
| 215 | + $installer->setPlatformRequirementFilter(((array)$trace['object'])["\0*\0platformRequirementFilter"]); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | if (0 !== $installer->run()) { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if (isset($package->getRequires()['php-http/discovery'])) { |
| 266 | - $requires[(int) isset($devPackages[$package->getName()])] += $package->getRequires(); |
|
| 266 | + $requires[(int)isset($devPackages[$package->getName()])] += $package->getRequires(); |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
@@ -188,7 +188,7 @@ |
||
| 188 | 188 | return self::safeClassExists($condition); |
| 189 | 189 | } |
| 190 | 190 | if (is_callable($condition)) { |
| 191 | - return (bool) $condition(); |
|
| 191 | + return (bool)$condition(); |
|
| 192 | 192 | } |
| 193 | 193 | if (is_bool($condition)) { |
| 194 | 194 | return $condition; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function __construct($strategy, array $candidates) |
| 18 | 18 | { |
| 19 | 19 | $classes = array_map( |
| 20 | - function ($a) { |
|
| 20 | + function($a) { |
|
| 21 | 21 | return $a['class']; |
| 22 | 22 | }, |
| 23 | 23 | $candidates |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | // If the node has a path we need to use it as prefix for the existing path |
| 220 | 220 | // @see https://github.com/elastic/elastic-transport-php/pull/20 |
| 221 | 221 | if (!empty($nodePath)) { |
| 222 | - $path = sprintf("%s/%s", rtrim($nodePath, '/'), ltrim($path,'/')); |
|
| 222 | + $path = sprintf("%s/%s", rtrim($nodePath, '/'), ltrim($path, '/')); |
|
| 223 | 223 | } |
| 224 | 224 | // If the user information is not in the request, we check if it is present in the node uri |
| 225 | 225 | // @see https://github.com/elastic/elastic-transport-php/issues/18 |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $this->logger->debug(sprintf( |
| 251 | 251 | "Headers: %s\nBody: %s", |
| 252 | 252 | json_encode($message->getHeaders()), |
| 253 | - (string) $message->getBody() |
|
| 253 | + (string)$message->getBody() |
|
| 254 | 254 | )); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | "%s: %s %s", |
| 261 | 261 | $title, |
| 262 | 262 | $request->getMethod(), |
| 263 | - (string) $request->getUri() |
|
| 263 | + (string)$request->getUri() |
|
| 264 | 264 | ), [ |
| 265 | 265 | 'request' => $request |
| 266 | 266 | ]); |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | $this->asyncClient = HttpAsyncClientDiscovery::find(); |
| 344 | 344 | } catch (Exception $e) { |
| 345 | 345 | throw new NoAsyncClientException(sprintf( |
| 346 | - "I did not find any HTTP library with HttpAsyncClient interface. " . |
|
| 347 | - "Make sure to install a package providing \"php-http/async-client-implementation\". " . |
|
| 346 | + "I did not find any HTTP library with HttpAsyncClient interface. ". |
|
| 347 | + "Make sure to install a package providing \"php-http/async-client-implementation\". ". |
|
| 348 | 348 | "You can also set a specific async library using %s::setAsyncClient()", |
| 349 | 349 | self::class |
| 350 | 350 | )); |
@@ -399,14 +399,14 @@ discard block |
||
| 399 | 399 | $promise = $client->sendAsyncRequest($request); |
| 400 | 400 | |
| 401 | 401 | // onFulfilled callable |
| 402 | - $onFulfilled = function (ResponseInterface $response) use (&$count) { |
|
| 402 | + $onFulfilled = function(ResponseInterface $response) use (&$count) { |
|
| 403 | 403 | $this->lastResponse = $response; |
| 404 | 404 | $this->logResponse("Async Response", $response, $count); |
| 405 | 405 | return $this->getAsyncOnSuccess()->success($response, $count); |
| 406 | 406 | }; |
| 407 | 407 | |
| 408 | 408 | // onRejected callable |
| 409 | - $onRejected = function (Exception $e) use ($client, $request, &$count, $node) { |
|
| 409 | + $onRejected = function(Exception $e) use ($client, $request, &$count, $node) { |
|
| 410 | 410 | $this->logger->error(sprintf("Retry %d: %s", $count, $e->getMessage())); |
| 411 | 411 | $this->getAsyncOnFailure()->failure($e, $request, $count, $node ?? null); |
| 412 | 412 | if (isset($node)) { |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | }; |
| 420 | 420 | |
| 421 | 421 | // Add getRetries() callables using then() |
| 422 | - for ($i=0; $i < $this->getRetries(); $i++) { |
|
| 422 | + for ($i = 0; $i < $this->getRetries(); $i++) { |
|
| 423 | 423 | $promise = $promise->then($onFulfilled, $onRejected); |
| 424 | 424 | } |
| 425 | 425 | // Add the last getRetries()+1 callable for managing the exceeded error |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | private function getOSVersion(): string |
| 440 | 440 | { |
| 441 | 441 | if (!isset($this->OSVersion)) { |
| 442 | - $disable_functions = (string) ini_get('disable_functions'); |
|
| 442 | + $disable_functions = (string)ini_get('disable_functions'); |
|
| 443 | 443 | $this->OSVersion = strpos(strtolower($disable_functions), 'php_uname') !== false |
| 444 | 444 | ? '' |
| 445 | 445 | : php_uname("r"); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public static function serialize($data, array $options = []): string |
| 27 | 27 | { |
| 28 | 28 | if (is_string($data) || is_numeric($data) || (is_object($data) && method_exists($data, '__toString'))) { |
| 29 | - return (string) $data; |
|
| 29 | + return (string)$data; |
|
| 30 | 30 | } |
| 31 | 31 | throw new SerializeException( |
| 32 | 32 | sprintf("I cannot serialize %s in a text", serialize($data)) |
@@ -39,9 +39,9 @@ |
||
| 39 | 39 | $result = ''; |
| 40 | 40 | foreach ($data as $row) { |
| 41 | 41 | if (is_array($row) || is_object($row)) { |
| 42 | - $result .= implode(',', (array) $row); |
|
| 42 | + $result .= implode(',', (array)$row); |
|
| 43 | 43 | } else { |
| 44 | - $result .= (string) $row; |
|
| 44 | + $result .= (string)$row; |
|
| 45 | 45 | } |
| 46 | 46 | $result .= "\n"; |
| 47 | 47 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $result .= "{}\n"; |
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | - $result .= JsonSerializer::serialize($row, $options) . "\n"; |
|
| 43 | + $result .= JsonSerializer::serialize($row, $options)."\n"; |
|
| 44 | 44 | } |
| 45 | 45 | return $result; |
| 46 | 46 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 11 | 11 | * See the LICENSE file in the project root for more information. |
| 12 | 12 | */ |
| 13 | -declare(strict_types = 1); |
|
| 13 | +declare(strict_types=1); |
|
| 14 | 14 | |
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Transport; |
| 16 | 16 | |