@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Traits; |
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Elasticsearch\Client; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } elseif (\is_array($value) && $this->isNestedArray($value) === \false) { |
| 67 | 67 | return \implode(',', $value); |
| 68 | 68 | } |
| 69 | - return (string) $value; |
|
| 69 | + return (string)$value; |
|
| 70 | 70 | } |
| 71 | 71 | /** |
| 72 | 72 | * Encode a value for a valid URL |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if (empty($queryParams)) { |
| 93 | 93 | return $url; |
| 94 | 94 | } |
| 95 | - return $url . '?' . http_build_query($queryParams); |
|
| 95 | + return $url.'?'.http_build_query($queryParams); |
|
| 96 | 96 | } |
| 97 | 97 | /** |
| 98 | 98 | * Serialize the body using the Content-Type |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | use function http_build_query; |
| 26 | 26 | use function strpos; |
| 27 | 27 | use function sprintf; |
| 28 | -trait EndpointTrait |
|
| 29 | -{ |
|
| 28 | +trait EndpointTrait { |
|
| 30 | 29 | /** |
| 31 | 30 | * Check if an array containts nested array |
| 32 | 31 | */ |
@@ -29,170 +29,170 @@ |
||
| 29 | 29 | use function sprintf; |
| 30 | 30 | trait EndpointTrait |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * Check if an array containts nested array |
|
| 34 | - */ |
|
| 35 | - private function isNestedArray(array $a) : bool |
|
| 36 | - { |
|
| 37 | - foreach ($a as $v) { |
|
| 38 | - if (\is_array($v)) { |
|
| 39 | - return \true; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - return \false; |
|
| 43 | - } |
|
| 44 | - /** |
|
| 45 | - * Check if an array is associative, i.e. has a string as key |
|
| 46 | - */ |
|
| 47 | - protected function isAssociativeArray(array $array) : bool |
|
| 48 | - { |
|
| 49 | - foreach ($array as $k => $v) { |
|
| 50 | - if (\is_string($k)) { |
|
| 51 | - return \true; |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - return \false; |
|
| 55 | - } |
|
| 56 | - /** |
|
| 57 | - * Converts array to comma-separated list; |
|
| 58 | - * Converts boolean value to true', 'false' string |
|
| 59 | - * |
|
| 60 | - * @param mixed $value |
|
| 61 | - */ |
|
| 62 | - private function convertValue($value) : string |
|
| 63 | - { |
|
| 64 | - // Convert a boolean value in 'true' or 'false' string |
|
| 65 | - if (\is_bool($value)) { |
|
| 66 | - return $value ? 'true' : 'false'; |
|
| 67 | - // Convert to comma-separated list if array |
|
| 68 | - } elseif (\is_array($value) && $this->isNestedArray($value) === \false) { |
|
| 69 | - return \implode(',', $value); |
|
| 70 | - } |
|
| 71 | - return (string) $value; |
|
| 72 | - } |
|
| 73 | - /** |
|
| 74 | - * Encode a value for a valid URL |
|
| 75 | - * |
|
| 76 | - * @param mixed $value |
|
| 77 | - */ |
|
| 78 | - protected function encode($value) : string |
|
| 79 | - { |
|
| 80 | - return Utility::urlencode($this->convertValue($value)); |
|
| 81 | - } |
|
| 82 | - /** |
|
| 83 | - * Returns the URL with the query string from $params |
|
| 84 | - * extracting the array keys specified in $keys |
|
| 85 | - */ |
|
| 86 | - protected function addQueryString(string $url, array $params, array $keys) : string |
|
| 87 | - { |
|
| 88 | - $queryParams = []; |
|
| 89 | - foreach ($keys as $k) { |
|
| 90 | - if (isset($params[$k])) { |
|
| 91 | - $queryParams[$k] = $this->convertValue($params[$k]); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - if (empty($queryParams)) { |
|
| 95 | - return $url; |
|
| 96 | - } |
|
| 97 | - return $url . '?' . http_build_query($queryParams); |
|
| 98 | - } |
|
| 99 | - /** |
|
| 100 | - * Serialize the body using the Content-Type |
|
| 101 | - * |
|
| 102 | - * @param mixed $body |
|
| 103 | - */ |
|
| 104 | - protected function bodySerialize($body, string $contentType) : string |
|
| 105 | - { |
|
| 106 | - if (strpos($contentType, 'application/x-ndjson') !== \false || strpos($contentType, 'application/vnd.elasticsearch+x-ndjson') !== \false) { |
|
| 107 | - return NDJsonSerializer::serialize($body, ['remove_null' => \false]); |
|
| 108 | - } |
|
| 109 | - if (strpos($contentType, 'application/json') !== \false || strpos($contentType, 'application/vnd.elasticsearch+json') !== \false) { |
|
| 110 | - return JsonSerializer::serialize($body, ['remove_null' => \false]); |
|
| 111 | - } |
|
| 112 | - throw new ContentTypeException(sprintf("The Content-Type %s is not managed by Elasticsearch serializer", $contentType)); |
|
| 113 | - } |
|
| 114 | - /** |
|
| 115 | - * Create a PSR-7 request |
|
| 116 | - * |
|
| 117 | - * @param array|string $body |
|
| 118 | - */ |
|
| 119 | - protected function createRequest(string $method, string $url, array $headers, $body = null) : RequestInterface |
|
| 120 | - { |
|
| 121 | - $requestFactory = Psr17FactoryDiscovery::findServerRequestFactory(); |
|
| 122 | - $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); |
|
| 123 | - $request = $requestFactory->createServerRequest($method, $url); |
|
| 124 | - // Body request |
|
| 125 | - if (!empty($body)) { |
|
| 126 | - if (!isset($headers['Content-Type'])) { |
|
| 127 | - throw new ContentTypeException(sprintf("The Content-Type is missing for %s %s", $method, $url)); |
|
| 128 | - } |
|
| 129 | - $content = \is_string($body) ? $body : $this->bodySerialize($body, $headers['Content-Type']); |
|
| 130 | - $request = $request->withBody($streamFactory->createStream($content)); |
|
| 131 | - } |
|
| 132 | - $headers = $this->buildCompatibilityHeaders($headers); |
|
| 133 | - // Headers |
|
| 134 | - foreach ($headers as $name => $value) { |
|
| 135 | - $request = $request->withHeader($name, $value); |
|
| 136 | - } |
|
| 137 | - return $request; |
|
| 138 | - } |
|
| 139 | - /** |
|
| 140 | - * Build the API compatibility headers |
|
| 141 | - * transfrom Content-Type and Accept adding vnd.elasticsearch+ and compatible-with |
|
| 142 | - * |
|
| 143 | - * @see https://github.com/elastic/elasticsearch-php/pull/1142 |
|
| 144 | - */ |
|
| 145 | - protected function buildCompatibilityHeaders(array $headers) : array |
|
| 146 | - { |
|
| 147 | - if (isset($headers['Content-Type'])) { |
|
| 148 | - if (\preg_match('/application\\/([^,]+)$/', $headers['Content-Type'], $matches)) { |
|
| 149 | - $headers['Content-Type'] = sprintf(Client::API_COMPATIBILITY_HEADER, 'application', $matches[1]); |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - if (isset($headers['Accept'])) { |
|
| 153 | - $values = \explode(',', $headers['Accept']); |
|
| 154 | - foreach ($values as &$value) { |
|
| 155 | - if (\preg_match('/(application|text)\\/([^,]+)/', $value, $matches)) { |
|
| 156 | - $value = sprintf(Client::API_COMPATIBILITY_HEADER, $matches[1], $matches[2]); |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - $headers['Accept'] = \implode(',', $values); |
|
| 160 | - } |
|
| 161 | - return $headers; |
|
| 162 | - } |
|
| 163 | - /** |
|
| 164 | - * Check if the $required parameters are present in $params |
|
| 165 | - * @throws MissingParameterException |
|
| 166 | - */ |
|
| 167 | - protected function checkRequiredParameters(array $required, array $params) : void |
|
| 168 | - { |
|
| 169 | - foreach ($required as $req) { |
|
| 170 | - if (!isset($params[$req])) { |
|
| 171 | - throw new MissingParameterException(sprintf('The parameter %s is required', $req)); |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - } |
|
| 175 | - /** |
|
| 176 | - * Add the OpenTelemetry attributes to the PSR-7 ServerRequest |
|
| 177 | - */ |
|
| 178 | - protected function addOtelAttributes(array $params, array $requiredPathParts, ServerRequestInterface $request, string $endpoint) : ServerRequestInterface |
|
| 179 | - { |
|
| 180 | - // Check if OpenTelemetry instrumentation is enbaled |
|
| 181 | - if (!\getenv(OpenTelemetry::ENV_VARIABLE_ENABLED)) { |
|
| 182 | - return $request; |
|
| 183 | - } |
|
| 184 | - $otel = []; |
|
| 185 | - foreach ($requiredPathParts as $part) { |
|
| 186 | - if (isset($params[$part])) { |
|
| 187 | - $otel["db.elasticsearch.path_parts.{$part}"] = $params[$part]; |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - if (\in_array($endpoint, Client::SEARCH_ENDPOINTS)) { |
|
| 191 | - $body = $request->getBody()->getContents(); |
|
| 192 | - if (!empty($body)) { |
|
| 193 | - $otel['db.query.text'] = OpenTelemetry::redactBody($body); |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - return $request->withAttribute(OpenTelemetry::PSR7_OTEL_ATTRIBUTE_NAME, \array_merge($otel, ['db.system' => 'elasticsearch', 'db.operation.name' => $endpoint])); |
|
| 197 | - } |
|
| 32 | + /** |
|
| 33 | + * Check if an array containts nested array |
|
| 34 | + */ |
|
| 35 | + private function isNestedArray(array $a) : bool |
|
| 36 | + { |
|
| 37 | + foreach ($a as $v) { |
|
| 38 | + if (\is_array($v)) { |
|
| 39 | + return \true; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + return \false; |
|
| 43 | + } |
|
| 44 | + /** |
|
| 45 | + * Check if an array is associative, i.e. has a string as key |
|
| 46 | + */ |
|
| 47 | + protected function isAssociativeArray(array $array) : bool |
|
| 48 | + { |
|
| 49 | + foreach ($array as $k => $v) { |
|
| 50 | + if (\is_string($k)) { |
|
| 51 | + return \true; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + return \false; |
|
| 55 | + } |
|
| 56 | + /** |
|
| 57 | + * Converts array to comma-separated list; |
|
| 58 | + * Converts boolean value to true', 'false' string |
|
| 59 | + * |
|
| 60 | + * @param mixed $value |
|
| 61 | + */ |
|
| 62 | + private function convertValue($value) : string |
|
| 63 | + { |
|
| 64 | + // Convert a boolean value in 'true' or 'false' string |
|
| 65 | + if (\is_bool($value)) { |
|
| 66 | + return $value ? 'true' : 'false'; |
|
| 67 | + // Convert to comma-separated list if array |
|
| 68 | + } elseif (\is_array($value) && $this->isNestedArray($value) === \false) { |
|
| 69 | + return \implode(',', $value); |
|
| 70 | + } |
|
| 71 | + return (string) $value; |
|
| 72 | + } |
|
| 73 | + /** |
|
| 74 | + * Encode a value for a valid URL |
|
| 75 | + * |
|
| 76 | + * @param mixed $value |
|
| 77 | + */ |
|
| 78 | + protected function encode($value) : string |
|
| 79 | + { |
|
| 80 | + return Utility::urlencode($this->convertValue($value)); |
|
| 81 | + } |
|
| 82 | + /** |
|
| 83 | + * Returns the URL with the query string from $params |
|
| 84 | + * extracting the array keys specified in $keys |
|
| 85 | + */ |
|
| 86 | + protected function addQueryString(string $url, array $params, array $keys) : string |
|
| 87 | + { |
|
| 88 | + $queryParams = []; |
|
| 89 | + foreach ($keys as $k) { |
|
| 90 | + if (isset($params[$k])) { |
|
| 91 | + $queryParams[$k] = $this->convertValue($params[$k]); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + if (empty($queryParams)) { |
|
| 95 | + return $url; |
|
| 96 | + } |
|
| 97 | + return $url . '?' . http_build_query($queryParams); |
|
| 98 | + } |
|
| 99 | + /** |
|
| 100 | + * Serialize the body using the Content-Type |
|
| 101 | + * |
|
| 102 | + * @param mixed $body |
|
| 103 | + */ |
|
| 104 | + protected function bodySerialize($body, string $contentType) : string |
|
| 105 | + { |
|
| 106 | + if (strpos($contentType, 'application/x-ndjson') !== \false || strpos($contentType, 'application/vnd.elasticsearch+x-ndjson') !== \false) { |
|
| 107 | + return NDJsonSerializer::serialize($body, ['remove_null' => \false]); |
|
| 108 | + } |
|
| 109 | + if (strpos($contentType, 'application/json') !== \false || strpos($contentType, 'application/vnd.elasticsearch+json') !== \false) { |
|
| 110 | + return JsonSerializer::serialize($body, ['remove_null' => \false]); |
|
| 111 | + } |
|
| 112 | + throw new ContentTypeException(sprintf("The Content-Type %s is not managed by Elasticsearch serializer", $contentType)); |
|
| 113 | + } |
|
| 114 | + /** |
|
| 115 | + * Create a PSR-7 request |
|
| 116 | + * |
|
| 117 | + * @param array|string $body |
|
| 118 | + */ |
|
| 119 | + protected function createRequest(string $method, string $url, array $headers, $body = null) : RequestInterface |
|
| 120 | + { |
|
| 121 | + $requestFactory = Psr17FactoryDiscovery::findServerRequestFactory(); |
|
| 122 | + $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); |
|
| 123 | + $request = $requestFactory->createServerRequest($method, $url); |
|
| 124 | + // Body request |
|
| 125 | + if (!empty($body)) { |
|
| 126 | + if (!isset($headers['Content-Type'])) { |
|
| 127 | + throw new ContentTypeException(sprintf("The Content-Type is missing for %s %s", $method, $url)); |
|
| 128 | + } |
|
| 129 | + $content = \is_string($body) ? $body : $this->bodySerialize($body, $headers['Content-Type']); |
|
| 130 | + $request = $request->withBody($streamFactory->createStream($content)); |
|
| 131 | + } |
|
| 132 | + $headers = $this->buildCompatibilityHeaders($headers); |
|
| 133 | + // Headers |
|
| 134 | + foreach ($headers as $name => $value) { |
|
| 135 | + $request = $request->withHeader($name, $value); |
|
| 136 | + } |
|
| 137 | + return $request; |
|
| 138 | + } |
|
| 139 | + /** |
|
| 140 | + * Build the API compatibility headers |
|
| 141 | + * transfrom Content-Type and Accept adding vnd.elasticsearch+ and compatible-with |
|
| 142 | + * |
|
| 143 | + * @see https://github.com/elastic/elasticsearch-php/pull/1142 |
|
| 144 | + */ |
|
| 145 | + protected function buildCompatibilityHeaders(array $headers) : array |
|
| 146 | + { |
|
| 147 | + if (isset($headers['Content-Type'])) { |
|
| 148 | + if (\preg_match('/application\\/([^,]+)$/', $headers['Content-Type'], $matches)) { |
|
| 149 | + $headers['Content-Type'] = sprintf(Client::API_COMPATIBILITY_HEADER, 'application', $matches[1]); |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + if (isset($headers['Accept'])) { |
|
| 153 | + $values = \explode(',', $headers['Accept']); |
|
| 154 | + foreach ($values as &$value) { |
|
| 155 | + if (\preg_match('/(application|text)\\/([^,]+)/', $value, $matches)) { |
|
| 156 | + $value = sprintf(Client::API_COMPATIBILITY_HEADER, $matches[1], $matches[2]); |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + $headers['Accept'] = \implode(',', $values); |
|
| 160 | + } |
|
| 161 | + return $headers; |
|
| 162 | + } |
|
| 163 | + /** |
|
| 164 | + * Check if the $required parameters are present in $params |
|
| 165 | + * @throws MissingParameterException |
|
| 166 | + */ |
|
| 167 | + protected function checkRequiredParameters(array $required, array $params) : void |
|
| 168 | + { |
|
| 169 | + foreach ($required as $req) { |
|
| 170 | + if (!isset($params[$req])) { |
|
| 171 | + throw new MissingParameterException(sprintf('The parameter %s is required', $req)); |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | + /** |
|
| 176 | + * Add the OpenTelemetry attributes to the PSR-7 ServerRequest |
|
| 177 | + */ |
|
| 178 | + protected function addOtelAttributes(array $params, array $requiredPathParts, ServerRequestInterface $request, string $endpoint) : ServerRequestInterface |
|
| 179 | + { |
|
| 180 | + // Check if OpenTelemetry instrumentation is enbaled |
|
| 181 | + if (!\getenv(OpenTelemetry::ENV_VARIABLE_ENABLED)) { |
|
| 182 | + return $request; |
|
| 183 | + } |
|
| 184 | + $otel = []; |
|
| 185 | + foreach ($requiredPathParts as $part) { |
|
| 186 | + if (isset($params[$part])) { |
|
| 187 | + $otel["db.elasticsearch.path_parts.{$part}"] = $params[$part]; |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + if (\in_array($endpoint, Client::SEARCH_ENDPOINTS)) { |
|
| 191 | + $body = $request->getBody()->getContents(); |
|
| 192 | + if (!empty($body)) { |
|
| 193 | + $otel['db.query.text'] = OpenTelemetry::redactBody($body); |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + return $request->withAttribute(OpenTelemetry::PSR7_OTEL_ATTRIBUTE_NAME, \array_merge($otel, ['db.system' => 'elasticsearch', 'db.operation.name' => $endpoint])); |
|
| 197 | + } |
|
| 198 | 198 | } |
@@ -23,47 +23,47 @@ |
||
| 23 | 23 | use function strpos; |
| 24 | 24 | class NDJsonSerializer implements SerializerInterface |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * The available $options are: |
|
| 28 | - * 'remove_null' => (bool) enable/disable the removing of |
|
| 29 | - * null values (default is true) |
|
| 30 | - * |
|
| 31 | - * @param array $data |
|
| 32 | - */ |
|
| 33 | - public static function serialize($data, array $options = []) : string |
|
| 34 | - { |
|
| 35 | - $result = ''; |
|
| 36 | - foreach ($data as $row) { |
|
| 37 | - if (empty($row)) { |
|
| 38 | - $result .= "{}\n"; |
|
| 39 | - continue; |
|
| 40 | - } |
|
| 41 | - $result .= JsonSerializer::serialize($row, $options) . "\n"; |
|
| 42 | - } |
|
| 43 | - return $result; |
|
| 44 | - } |
|
| 45 | - /** |
|
| 46 | - * The available options are: |
|
| 47 | - * 'type' => (string) specify if the array result should contain object |
|
| 48 | - * or array (default is array) |
|
| 49 | - * |
|
| 50 | - * @inheritdoc |
|
| 51 | - */ |
|
| 52 | - public static function unserialize(string $data, array $options = []) |
|
| 53 | - { |
|
| 54 | - $array = explode(strpos($data, "\r\n") !== \false ? "\r\n" : "\n", $data); |
|
| 55 | - $result = []; |
|
| 56 | - foreach ($array as $json) { |
|
| 57 | - if (empty($json)) { |
|
| 58 | - continue; |
|
| 59 | - } |
|
| 60 | - try { |
|
| 61 | - $result[] = JsonSerializer::unserialize($json, $options); |
|
| 62 | - } catch (JsonException $e) { |
|
| 63 | - throw new InvalidJsonException(sprintf("Not a valid NDJson: %s", $e->getMessage())); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - $type = $options['type'] ?? 'array'; |
|
| 67 | - return $type === 'array' ? $result : new ArrayObject($result); |
|
| 68 | - } |
|
| 26 | + /** |
|
| 27 | + * The available $options are: |
|
| 28 | + * 'remove_null' => (bool) enable/disable the removing of |
|
| 29 | + * null values (default is true) |
|
| 30 | + * |
|
| 31 | + * @param array $data |
|
| 32 | + */ |
|
| 33 | + public static function serialize($data, array $options = []) : string |
|
| 34 | + { |
|
| 35 | + $result = ''; |
|
| 36 | + foreach ($data as $row) { |
|
| 37 | + if (empty($row)) { |
|
| 38 | + $result .= "{}\n"; |
|
| 39 | + continue; |
|
| 40 | + } |
|
| 41 | + $result .= JsonSerializer::serialize($row, $options) . "\n"; |
|
| 42 | + } |
|
| 43 | + return $result; |
|
| 44 | + } |
|
| 45 | + /** |
|
| 46 | + * The available options are: |
|
| 47 | + * 'type' => (string) specify if the array result should contain object |
|
| 48 | + * or array (default is array) |
|
| 49 | + * |
|
| 50 | + * @inheritdoc |
|
| 51 | + */ |
|
| 52 | + public static function unserialize(string $data, array $options = []) |
|
| 53 | + { |
|
| 54 | + $array = explode(strpos($data, "\r\n") !== \false ? "\r\n" : "\n", $data); |
|
| 55 | + $result = []; |
|
| 56 | + foreach ($array as $json) { |
|
| 57 | + if (empty($json)) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 60 | + try { |
|
| 61 | + $result[] = JsonSerializer::unserialize($json, $options); |
|
| 62 | + } catch (JsonException $e) { |
|
| 63 | + throw new InvalidJsonException(sprintf("Not a valid NDJson: %s", $e->getMessage())); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + $type = $options['type'] ?? 'array'; |
|
| 67 | + return $type === 'array' ? $result : new ArrayObject($result); |
|
| 68 | + } |
|
| 69 | 69 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | use ArrayObject; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $result .= "{}\n"; |
| 39 | 39 | continue; |
| 40 | 40 | } |
| 41 | - $result .= JsonSerializer::serialize($row, $options) . "\n"; |
|
| 41 | + $result .= JsonSerializer::serialize($row, $options)."\n"; |
|
| 42 | 42 | } |
| 43 | 43 | return $result; |
| 44 | 44 | } |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | use function json_decode; |
| 22 | 22 | use function sprintf; |
| 23 | 23 | use function strpos; |
| 24 | -class NDJsonSerializer implements SerializerInterface |
|
| 25 | -{ |
|
| 24 | +class NDJsonSerializer implements SerializerInterface { |
|
| 26 | 25 | /** |
| 27 | 26 | * The available $options are: |
| 28 | 27 | * 'remove_null' => (bool) enable/disable the removing of |
@@ -21,30 +21,30 @@ |
||
| 21 | 21 | use function sprintf; |
| 22 | 22 | class Utility |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Remove null values form array or object |
|
| 26 | - * |
|
| 27 | - * @param mixed $data |
|
| 28 | - * @return void |
|
| 29 | - */ |
|
| 30 | - public static function removeNullValue(&$data) : void |
|
| 31 | - { |
|
| 32 | - if (!is_object($data) && !is_array($data)) { |
|
| 33 | - throw new InvalidArgumentException(sprintf("The parameter %s must be an object or array", var_export($data, \true))); |
|
| 34 | - } |
|
| 35 | - /** @phpstan-ignore-next-line */ |
|
| 36 | - foreach ($data as $property => &$value) { |
|
| 37 | - if (is_object($value) || is_array($value)) { |
|
| 38 | - self::removeNullValue($value); |
|
| 39 | - } |
|
| 40 | - if (null === $value) { |
|
| 41 | - if (is_array($data)) { |
|
| 42 | - unset($data[$property]); |
|
| 43 | - } |
|
| 44 | - if (is_object($data)) { |
|
| 45 | - unset($data->{$property}); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - } |
|
| 24 | + /** |
|
| 25 | + * Remove null values form array or object |
|
| 26 | + * |
|
| 27 | + * @param mixed $data |
|
| 28 | + * @return void |
|
| 29 | + */ |
|
| 30 | + public static function removeNullValue(&$data) : void |
|
| 31 | + { |
|
| 32 | + if (!is_object($data) && !is_array($data)) { |
|
| 33 | + throw new InvalidArgumentException(sprintf("The parameter %s must be an object or array", var_export($data, \true))); |
|
| 34 | + } |
|
| 35 | + /** @phpstan-ignore-next-line */ |
|
| 36 | + foreach ($data as $property => &$value) { |
|
| 37 | + if (is_object($value) || is_array($value)) { |
|
| 38 | + self::removeNullValue($value); |
|
| 39 | + } |
|
| 40 | + if (null === $value) { |
|
| 41 | + if (is_array($data)) { |
|
| 42 | + unset($data[$property]); |
|
| 43 | + } |
|
| 44 | + if (is_object($data)) { |
|
| 45 | + unset($data->{$property}); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\InvalidArgumentException; |
@@ -19,8 +19,7 @@ |
||
| 19 | 19 | use function is_object; |
| 20 | 20 | use function var_export; |
| 21 | 21 | use function sprintf; |
| 22 | -class Utility |
|
| 23 | -{ |
|
| 22 | +class Utility { |
|
| 24 | 23 | /** |
| 25 | 24 | * Remove null values form array or object |
| 26 | 25 | * |
@@ -16,16 +16,16 @@ |
||
| 16 | 16 | |
| 17 | 17 | interface SerializerInterface |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * @param mixed $data |
|
| 21 | - * @param array $options |
|
| 22 | - * @return string |
|
| 23 | - */ |
|
| 24 | - public static function serialize($data, array $options = []) : string; |
|
| 25 | - /** |
|
| 26 | - * @param string $data |
|
| 27 | - * @param array $options |
|
| 28 | - * @return mixed |
|
| 29 | - */ |
|
| 30 | - public static function unserialize(string $data, array $options = []); |
|
| 19 | + /** |
|
| 20 | + * @param mixed $data |
|
| 21 | + * @param array $options |
|
| 22 | + * @return string |
|
| 23 | + */ |
|
| 24 | + public static function serialize($data, array $options = []) : string; |
|
| 25 | + /** |
|
| 26 | + * @param string $data |
|
| 27 | + * @param array $options |
|
| 28 | + * @return mixed |
|
| 29 | + */ |
|
| 30 | + public static function unserialize(string $data, array $options = []); |
|
| 31 | 31 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | interface SerializerInterface |
@@ -14,8 +14,7 @@ |
||
| 14 | 14 | declare (strict_types=1); |
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | -interface SerializerInterface |
|
| 18 | -{ |
|
| 17 | +interface SerializerInterface { |
|
| 19 | 18 | /** |
| 20 | 19 | * @param mixed $data |
| 21 | 20 | * @param array $options |
@@ -22,36 +22,36 @@ |
||
| 22 | 22 | use function substr; |
| 23 | 23 | class CsvSerializer implements SerializerInterface |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * @inheritdoc |
|
| 27 | - * |
|
| 28 | - * @throws InvalidIterableException |
|
| 29 | - */ |
|
| 30 | - public static function serialize($data, array $options = []) : string |
|
| 31 | - { |
|
| 32 | - if (!is_iterable($data)) { |
|
| 33 | - throw new InvalidIterableException(sprintf("The parameter %s is not iterable", \serialize($data))); |
|
| 34 | - } |
|
| 35 | - $result = ''; |
|
| 36 | - foreach ($data as $row) { |
|
| 37 | - if (\is_array($row) || \is_object($row)) { |
|
| 38 | - $result .= \implode(',', (array) $row); |
|
| 39 | - } else { |
|
| 40 | - $result .= (string) $row; |
|
| 41 | - } |
|
| 42 | - $result .= "\n"; |
|
| 43 | - } |
|
| 44 | - return empty($result) ? $result : substr($result, 0, -1); |
|
| 45 | - } |
|
| 46 | - /** |
|
| 47 | - * @return array |
|
| 48 | - */ |
|
| 49 | - public static function unserialize(string $data, array $options = []) : array |
|
| 50 | - { |
|
| 51 | - $result = []; |
|
| 52 | - foreach (explode("\n", $data) as $row) { |
|
| 53 | - $result[] = str_getcsv($row); |
|
| 54 | - } |
|
| 55 | - return $result; |
|
| 56 | - } |
|
| 25 | + /** |
|
| 26 | + * @inheritdoc |
|
| 27 | + * |
|
| 28 | + * @throws InvalidIterableException |
|
| 29 | + */ |
|
| 30 | + public static function serialize($data, array $options = []) : string |
|
| 31 | + { |
|
| 32 | + if (!is_iterable($data)) { |
|
| 33 | + throw new InvalidIterableException(sprintf("The parameter %s is not iterable", \serialize($data))); |
|
| 34 | + } |
|
| 35 | + $result = ''; |
|
| 36 | + foreach ($data as $row) { |
|
| 37 | + if (\is_array($row) || \is_object($row)) { |
|
| 38 | + $result .= \implode(',', (array) $row); |
|
| 39 | + } else { |
|
| 40 | + $result .= (string) $row; |
|
| 41 | + } |
|
| 42 | + $result .= "\n"; |
|
| 43 | + } |
|
| 44 | + return empty($result) ? $result : substr($result, 0, -1); |
|
| 45 | + } |
|
| 46 | + /** |
|
| 47 | + * @return array |
|
| 48 | + */ |
|
| 49 | + public static function unserialize(string $data, array $options = []) : array |
|
| 50 | + { |
|
| 51 | + $result = []; |
|
| 52 | + foreach (explode("\n", $data) as $row) { |
|
| 53 | + $result[] = str_getcsv($row); |
|
| 54 | + } |
|
| 55 | + return $result; |
|
| 56 | + } |
|
| 57 | 57 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\InvalidIterableException; |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | $result = ''; |
| 36 | 36 | foreach ($data as $row) { |
| 37 | 37 | if (\is_array($row) || \is_object($row)) { |
| 38 | - $result .= \implode(',', (array) $row); |
|
| 38 | + $result .= \implode(',', (array)$row); |
|
| 39 | 39 | } else { |
| 40 | - $result .= (string) $row; |
|
| 40 | + $result .= (string)$row; |
|
| 41 | 41 | } |
| 42 | 42 | $result .= "\n"; |
| 43 | 43 | } |
@@ -20,8 +20,7 @@ |
||
| 20 | 20 | use function sprintf; |
| 21 | 21 | use function str_getcsv; |
| 22 | 22 | use function substr; |
| 23 | -class CsvSerializer implements SerializerInterface |
|
| 24 | -{ |
|
| 23 | +class CsvSerializer implements SerializerInterface { |
|
| 25 | 24 | /** |
| 26 | 25 | * @inheritdoc |
| 27 | 26 | * |
@@ -23,48 +23,48 @@ |
||
| 23 | 23 | use function sprintf; |
| 24 | 24 | class JsonSerializer implements SerializerInterface |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * The available $options are: |
|
| 28 | - * 'remove_null' => (bool) enable/disable the removing of |
|
| 29 | - * null values (default is true) |
|
| 30 | - * |
|
| 31 | - * @param mixed $data |
|
| 32 | - */ |
|
| 33 | - public static function serialize($data, array $options = []) : string |
|
| 34 | - { |
|
| 35 | - if (empty($data)) { |
|
| 36 | - return '{}'; |
|
| 37 | - } |
|
| 38 | - if (\is_string($data)) { |
|
| 39 | - return $data; |
|
| 40 | - } |
|
| 41 | - try { |
|
| 42 | - $removeNull = $options['remove_null'] ?? \true; |
|
| 43 | - if ($removeNull) { |
|
| 44 | - Utility::removeNullValue($data); |
|
| 45 | - } |
|
| 46 | - return json_encode($data, \JSON_PRESERVE_ZERO_FRACTION + \JSON_INVALID_UTF8_SUBSTITUTE + \JSON_THROW_ON_ERROR); |
|
| 47 | - } catch (JsonException $e) { |
|
| 48 | - throw new InvalidJsonException(sprintf("I cannot serialize to Json: %s", $e->getMessage())); |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - /** |
|
| 52 | - * The available options are: |
|
| 53 | - * 'type' => (string) specify if the output should be an array |
|
| 54 | - * or an object (default is array) |
|
| 55 | - * |
|
| 56 | - * @inheritdoc |
|
| 57 | - */ |
|
| 58 | - public static function unserialize(string $data, array $options = []) |
|
| 59 | - { |
|
| 60 | - try { |
|
| 61 | - $type = $options['type'] ?? 'array'; |
|
| 62 | - if (!in_array($type, ['object', 'array'])) { |
|
| 63 | - throw new UndefinedPropertyException("The unserialize 'type' option must be object or array"); |
|
| 64 | - } |
|
| 65 | - return json_decode($data, $type === 'array', 512, \JSON_THROW_ON_ERROR); |
|
| 66 | - } catch (JsonException $e) { |
|
| 67 | - throw new InvalidJsonException(sprintf("Not a valid Json: %s", $e->getMessage())); |
|
| 68 | - } |
|
| 69 | - } |
|
| 26 | + /** |
|
| 27 | + * The available $options are: |
|
| 28 | + * 'remove_null' => (bool) enable/disable the removing of |
|
| 29 | + * null values (default is true) |
|
| 30 | + * |
|
| 31 | + * @param mixed $data |
|
| 32 | + */ |
|
| 33 | + public static function serialize($data, array $options = []) : string |
|
| 34 | + { |
|
| 35 | + if (empty($data)) { |
|
| 36 | + return '{}'; |
|
| 37 | + } |
|
| 38 | + if (\is_string($data)) { |
|
| 39 | + return $data; |
|
| 40 | + } |
|
| 41 | + try { |
|
| 42 | + $removeNull = $options['remove_null'] ?? \true; |
|
| 43 | + if ($removeNull) { |
|
| 44 | + Utility::removeNullValue($data); |
|
| 45 | + } |
|
| 46 | + return json_encode($data, \JSON_PRESERVE_ZERO_FRACTION + \JSON_INVALID_UTF8_SUBSTITUTE + \JSON_THROW_ON_ERROR); |
|
| 47 | + } catch (JsonException $e) { |
|
| 48 | + throw new InvalidJsonException(sprintf("I cannot serialize to Json: %s", $e->getMessage())); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + /** |
|
| 52 | + * The available options are: |
|
| 53 | + * 'type' => (string) specify if the output should be an array |
|
| 54 | + * or an object (default is array) |
|
| 55 | + * |
|
| 56 | + * @inheritdoc |
|
| 57 | + */ |
|
| 58 | + public static function unserialize(string $data, array $options = []) |
|
| 59 | + { |
|
| 60 | + try { |
|
| 61 | + $type = $options['type'] ?? 'array'; |
|
| 62 | + if (!in_array($type, ['object', 'array'])) { |
|
| 63 | + throw new UndefinedPropertyException("The unserialize 'type' option must be object or array"); |
|
| 64 | + } |
|
| 65 | + return json_decode($data, $type === 'array', 512, \JSON_THROW_ON_ERROR); |
|
| 66 | + } catch (JsonException $e) { |
|
| 67 | + throw new InvalidJsonException(sprintf("Not a valid Json: %s", $e->getMessage())); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\InvalidJsonException; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | if ($removeNull) { |
| 44 | 44 | Utility::removeNullValue($data); |
| 45 | 45 | } |
| 46 | - return json_encode($data, \JSON_PRESERVE_ZERO_FRACTION + \JSON_INVALID_UTF8_SUBSTITUTE + \JSON_THROW_ON_ERROR); |
|
| 46 | + return json_encode($data, \JSON_PRESERVE_ZERO_FRACTION +\JSON_INVALID_UTF8_SUBSTITUTE +\JSON_THROW_ON_ERROR); |
|
| 47 | 47 | } catch (JsonException $e) { |
| 48 | 48 | throw new InvalidJsonException(sprintf("I cannot serialize to Json: %s", $e->getMessage())); |
| 49 | 49 | } |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | use function json_decode; |
| 22 | 22 | use function json_encode; |
| 23 | 23 | use function sprintf; |
| 24 | -class JsonSerializer implements SerializerInterface |
|
| 25 | -{ |
|
| 24 | +class JsonSerializer implements SerializerInterface { |
|
| 26 | 25 | /** |
| 27 | 26 | * The available $options are: |
| 28 | 27 | * 'remove_null' => (bool) enable/disable the removing of |
@@ -18,21 +18,21 @@ |
||
| 18 | 18 | use function serialize; |
| 19 | 19 | class TextSerializer implements SerializerInterface |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * @throws SerializeException |
|
| 23 | - */ |
|
| 24 | - public static function serialize($data, array $options = []) : string |
|
| 25 | - { |
|
| 26 | - if (\is_string($data) || \is_numeric($data) || \is_object($data) && \method_exists($data, '__toString')) { |
|
| 27 | - return (string) $data; |
|
| 28 | - } |
|
| 29 | - throw new SerializeException(\sprintf("I cannot serialize %s in a text", serialize($data))); |
|
| 30 | - } |
|
| 31 | - /** |
|
| 32 | - * @return string |
|
| 33 | - */ |
|
| 34 | - public static function unserialize(string $data, array $options = []) : string |
|
| 35 | - { |
|
| 36 | - return $data; |
|
| 37 | - } |
|
| 21 | + /** |
|
| 22 | + * @throws SerializeException |
|
| 23 | + */ |
|
| 24 | + public static function serialize($data, array $options = []) : string |
|
| 25 | + { |
|
| 26 | + if (\is_string($data) || \is_numeric($data) || \is_object($data) && \method_exists($data, '__toString')) { |
|
| 27 | + return (string) $data; |
|
| 28 | + } |
|
| 29 | + throw new SerializeException(\sprintf("I cannot serialize %s in a text", serialize($data))); |
|
| 30 | + } |
|
| 31 | + /** |
|
| 32 | + * @return string |
|
| 33 | + */ |
|
| 34 | + public static function unserialize(string $data, array $options = []) : string |
|
| 35 | + { |
|
| 36 | + return $data; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\SerializeException; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public static function serialize($data, array $options = []) : string |
| 25 | 25 | { |
| 26 | 26 | if (\is_string($data) || \is_numeric($data) || \is_object($data) && \method_exists($data, '__toString')) { |
| 27 | - return (string) $data; |
|
| 27 | + return (string)$data; |
|
| 28 | 28 | } |
| 29 | 29 | throw new SerializeException(\sprintf("I cannot serialize %s in a text", serialize($data))); |
| 30 | 30 | } |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\SerializeException; |
| 18 | 18 | use function serialize; |
| 19 | -class TextSerializer implements SerializerInterface |
|
| 20 | -{ |
|
| 19 | +class TextSerializer implements SerializerInterface { |
|
| 21 | 20 | /** |
| 22 | 21 | * @throws SerializeException |
| 23 | 22 | */ |
@@ -23,25 +23,25 @@ |
||
| 23 | 23 | use function sprintf; |
| 24 | 24 | class XmlSerializer implements SerializerInterface |
| 25 | 25 | { |
| 26 | - public static function serialize($data, array $options = []) : string |
|
| 27 | - { |
|
| 28 | - if ($data instanceof SimpleXMLElement) { |
|
| 29 | - $xml = $data->asXML(); |
|
| 30 | - return \false === $xml ? '' : $xml; |
|
| 31 | - } |
|
| 32 | - throw new InvalidXmlException(sprintf("Not a valid SimpleXMLElement: %s", serialize($data))); |
|
| 33 | - } |
|
| 34 | - /** |
|
| 35 | - * @return SimpleXMLElement |
|
| 36 | - */ |
|
| 37 | - public static function unserialize(string $data, array $options = []) : SimpleXMLElement |
|
| 38 | - { |
|
| 39 | - $result = simplexml_load_string($data); |
|
| 40 | - if (\false === $result) { |
|
| 41 | - $errors = libxml_get_errors(); |
|
| 42 | - libxml_clear_errors(); |
|
| 43 | - throw new InvalidXmlException(sprintf("Not a valid XML: %s", serialize($errors))); |
|
| 44 | - } |
|
| 45 | - return $result; |
|
| 46 | - } |
|
| 26 | + public static function serialize($data, array $options = []) : string |
|
| 27 | + { |
|
| 28 | + if ($data instanceof SimpleXMLElement) { |
|
| 29 | + $xml = $data->asXML(); |
|
| 30 | + return \false === $xml ? '' : $xml; |
|
| 31 | + } |
|
| 32 | + throw new InvalidXmlException(sprintf("Not a valid SimpleXMLElement: %s", serialize($data))); |
|
| 33 | + } |
|
| 34 | + /** |
|
| 35 | + * @return SimpleXMLElement |
|
| 36 | + */ |
|
| 37 | + public static function unserialize(string $data, array $options = []) : SimpleXMLElement |
|
| 38 | + { |
|
| 39 | + $result = simplexml_load_string($data); |
|
| 40 | + if (\false === $result) { |
|
| 41 | + $errors = libxml_get_errors(); |
|
| 42 | + libxml_clear_errors(); |
|
| 43 | + throw new InvalidXmlException(sprintf("Not a valid XML: %s", serialize($errors))); |
|
| 44 | + } |
|
| 45 | + return $result; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Serializer; |
| 16 | 16 | |
| 17 | 17 | use OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception\InvalidXmlException; |
@@ -21,8 +21,7 @@ |
||
| 21 | 21 | use function serialize; |
| 22 | 22 | use function simplexml_load_string; |
| 23 | 23 | use function sprintf; |
| 24 | -class XmlSerializer implements SerializerInterface |
|
| 25 | -{ |
|
| 24 | +class XmlSerializer implements SerializerInterface { |
|
| 26 | 25 | public static function serialize($data, array $options = []) : string |
| 27 | 26 | { |
| 28 | 27 | if ($data instanceof SimpleXMLElement) { |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * Elasticsearch B.V licenses this file to you under the MIT License. |
| 12 | 12 | * See the LICENSE file in the project root for more information. |
| 13 | 13 | */ |
| 14 | -declare (strict_types=1); |
|
| 14 | +declare(strict_types=1); |
|
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception; |
| 16 | 16 | |
| 17 | 17 | use RuntimeException; |
@@ -15,6 +15,5 @@ |
||
| 15 | 15 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Elastic\Transport\Exception; |
| 16 | 16 | |
| 17 | 17 | use RuntimeException; |
| 18 | -class InvalidArrayException extends RuntimeException implements TransportException |
|
| 19 | -{ |
|
| 18 | +class InvalidArrayException extends RuntimeException implements TransportException { |
|
| 20 | 19 | } |