@@ -156,7 +156,7 @@ |
||
| 156 | 156 | $this->log->debug("Curl Options:", $opts); |
| 157 | 157 | |
| 158 | 158 | $this->lastRequest = array('request' => |
| 159 | - array( |
|
| 159 | + array( |
|
| 160 | 160 | 'uri' => $uri, |
| 161 | 161 | 'body' => $body, |
| 162 | 162 | 'options' => $options, |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | private $curlOpts; |
| 47 | 47 | |
| 48 | - private $lastRequest = array(); |
|
| 48 | + private $lastRequest = array (); |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | * @throws \Elasticsearch\Common\Exceptions\ServerErrorResponseException |
| 117 | 117 | * @return array |
| 118 | 118 | */ |
| 119 | - public function performRequest($method, $uri, $params = null, $body = null, $options = array()) |
|
| 119 | + public function performRequest($method, $uri, $params = null, $body = null, $options = array ()) |
|
| 120 | 120 | { |
| 121 | 121 | $curlHandle = curl_init(); |
| 122 | 122 | $opts = $this->curlOpts; |
| 123 | - $perRequestCurlOpts = array(); |
|
| 123 | + $perRequestCurlOpts = array (); |
|
| 124 | 124 | |
| 125 | 125 | if (isset($params['curlOpts']) === true) { |
| 126 | 126 | $perRequestCurlOpts = $params['curlOpts']; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $opts[CURLOPT_URL] = $uri; |
| 133 | 133 | |
| 134 | 134 | if (isset($opts[CURLOPT_CUSTOMREQUEST]) !== true) { |
| 135 | - $opts[CURLOPT_CUSTOMREQUEST]= $method; |
|
| 135 | + $opts[CURLOPT_CUSTOMREQUEST] = $method; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (count($options) > 0) { |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // Add in our custom per-request curl opts after everything is generated |
| 154 | - $opts = $perRequestCurlOpts + $opts; // Left-hand takes precedence over right-hand |
|
| 154 | + $opts = $perRequestCurlOpts + $opts; // Left-hand takes precedence over right-hand |
|
| 155 | 155 | |
| 156 | 156 | $this->log->debug("Curl Options:", $opts); |
| 157 | 157 | |
| 158 | - $this->lastRequest = array('request' => |
|
| 159 | - array( |
|
| 158 | + $this->lastRequest = array ('request' => |
|
| 159 | + array ( |
|
| 160 | 160 | 'uri' => $uri, |
| 161 | 161 | 'body' => $body, |
| 162 | 162 | 'options' => $options, |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | curl_setopt_array($curlHandle, $opts); |
| 168 | 168 | curl_multi_add_handle($this->multiHandle, $curlHandle); |
| 169 | 169 | |
| 170 | - $response = array(); |
|
| 170 | + $response = array (); |
|
| 171 | 171 | |
| 172 | 172 | |
| 173 | 173 | do { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $method, |
| 233 | 233 | $uri, |
| 234 | 234 | $body, |
| 235 | - "", //TODO FIX THIS |
|
| 235 | + "", //TODO FIX THIS |
|
| 236 | 236 | $response['requestInfo']['http_code'], |
| 237 | 237 | $response['responseText'], |
| 238 | 238 | $response['requestInfo']['total_time'] |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | |
| 242 | 242 | |
| 243 | - return array( |
|
| 243 | + return array ( |
|
| 244 | 244 | 'status' => $response['requestInfo']['http_code'], |
| 245 | 245 | 'text' => $response['responseText'], |
| 246 | 246 | 'info' => $response['requestInfo'], |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | } elseif ($statusCode === 409) { |
| 291 | 291 | throw new Conflict409Exception($responseBody, $statusCode); |
| 292 | 292 | } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { |
| 293 | - throw new ScriptLangNotSupportedException($responseBody. $statusCode); |
|
| 293 | + throw new ScriptLangNotSupportedException($responseBody . $statusCode); |
|
| 294 | 294 | } elseif ($statusCode === 400) { |
| 295 | 295 | throw new BadRequest400Exception($responseBody, $statusCode); |
| 296 | 296 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== false) { |
| 322 | 322 | throw new RoutingMissingException($responseBody, $statusCode); |
| 323 | - } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/',$responseBody) === 1) { |
|
| 323 | + } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/', $responseBody) === 1) { |
|
| 324 | 324 | throw new NoDocumentsToGetException($responseBody, $statusCode); |
| 325 | 325 | } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) { |
| 326 | 326 | throw new NoShardAvailableException($responseBody, $statusCode); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | private function generateCurlOpts($connectionParams) |
| 426 | 426 | { |
| 427 | - $opts = array( |
|
| 427 | + $opts = array ( |
|
| 428 | 428 | CURLOPT_RETURNTRANSFER => true, |
| 429 | 429 | CURLOPT_TIMEOUT_MS => 1000, |
| 430 | 430 | CURLOPT_CONNECTTIMEOUT_MS => 1000, |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | if (isset($connectionParams['curlOpts'])) { |
| 447 | 447 | //MUST use union operator, array_merge rekeys numeric |
| 448 | - $opts = $connectionParams['curlOpts'] + $opts; |
|
| 448 | + $opts = $connectionParams['curlOpts'] + $opts; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | return $opts; |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | private function reconcileOptions($options) |
| 455 | 455 | { |
| 456 | - $opts = array(); |
|
| 456 | + $opts = array (); |
|
| 457 | 457 | if (isset($options['timeout']) === true) { |
| 458 | 458 | $opts[CURLOPT_TIMEOUT_MS] = $options['timeout']; |
| 459 | 459 | $opts[CURLOPT_CONNECTTIMEOUT_MS] = $options['timeout']; |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 34 | 34 | * @link http://elasticsearch.org |
| 35 | 35 | */ |
| 36 | -class CurlMultiConnection extends AbstractConnection implements ConnectionInterface |
|
| 37 | -{ |
|
| 36 | +class CurlMultiConnection extends AbstractConnection implements ConnectionInterface { |
|
| 38 | 37 | |
| 39 | 38 | /** |
| 40 | 39 | * @var Resource |
@@ -60,8 +59,7 @@ discard block |
||
| 60 | 59 | * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException |
| 61 | 60 | * @return CurlMultiConnection |
| 62 | 61 | */ |
| 63 | - public function __construct($hostDetails, $connectionParams, LoggerInterface $log, LoggerInterface $trace) |
|
| 64 | - { |
|
| 62 | + public function __construct($hostDetails, $connectionParams, LoggerInterface $log, LoggerInterface $trace) { |
|
| 65 | 63 | parent::__construct($hostDetails, $connectionParams, $log, $trace); |
| 66 | 64 | |
| 67 | 65 | if (extension_loaded('curl') !== true) { |
@@ -96,8 +94,7 @@ discard block |
||
| 96 | 94 | * |
| 97 | 95 | * @return string |
| 98 | 96 | */ |
| 99 | - public function getTransportSchema() |
|
| 100 | - { |
|
| 97 | + public function getTransportSchema() { |
|
| 101 | 98 | return $this->transportSchema; |
| 102 | 99 | |
| 103 | 100 | } |
@@ -116,8 +113,7 @@ discard block |
||
| 116 | 113 | * @throws \Elasticsearch\Common\Exceptions\ServerErrorResponseException |
| 117 | 114 | * @return array |
| 118 | 115 | */ |
| 119 | - public function performRequest($method, $uri, $params = null, $body = null, $options = array()) |
|
| 120 | - { |
|
| 116 | + public function performRequest($method, $uri, $params = null, $body = null, $options = array()) { |
|
| 121 | 117 | $curlHandle = curl_init(); |
| 122 | 118 | $opts = $this->curlOpts; |
| 123 | 119 | $perRequestCurlOpts = array(); |
@@ -252,8 +248,7 @@ discard block |
||
| 252 | 248 | /** |
| 253 | 249 | * @return array |
| 254 | 250 | */ |
| 255 | - public function getLastRequestInfo() |
|
| 256 | - { |
|
| 251 | + public function getLastRequestInfo() { |
|
| 257 | 252 | return $this->lastRequest; |
| 258 | 253 | } |
| 259 | 254 | |
@@ -269,8 +264,7 @@ discard block |
||
| 269 | 264 | * @throws \Elasticsearch\Common\Exceptions\Missing404Exception |
| 270 | 265 | * @throws \Elasticsearch\Common\Exceptions\AlreadyExpiredException |
| 271 | 266 | */ |
| 272 | - private function process4xxError($method, $uri, $request, $response) |
|
| 273 | - { |
|
| 267 | + private function process4xxError($method, $uri, $request, $response) { |
|
| 274 | 268 | $this->logErrorDueToFailure($method, $uri, $request, $response); |
| 275 | 269 | |
| 276 | 270 | $statusCode = $response['requestInfo']['http_code']; |
@@ -307,8 +301,7 @@ discard block |
||
| 307 | 301 | * @throws \Elasticsearch\Common\Exceptions\NoDocumentsToGetException |
| 308 | 302 | * @throws \Elasticsearch\Common\Exceptions\ServerErrorResponseException |
| 309 | 303 | */ |
| 310 | - private function process5xxError($method, $uri, $request, $response) |
|
| 311 | - { |
|
| 304 | + private function process5xxError($method, $uri, $request, $response) { |
|
| 312 | 305 | $this->logErrorDueToFailure($method, $uri, $request, $response); |
| 313 | 306 | |
| 314 | 307 | $statusCode = $response['requestInfo']['http_code']; |
@@ -337,8 +330,7 @@ discard block |
||
| 337 | 330 | * @param $uri |
| 338 | 331 | * @param $response |
| 339 | 332 | */ |
| 340 | - private function processCurlError($method, $uri, $response) |
|
| 341 | - { |
|
| 333 | + private function processCurlError($method, $uri, $response) { |
|
| 342 | 334 | $error = 'Curl error: ' . $response['error']; |
| 343 | 335 | $this->log->error($error); |
| 344 | 336 | $this->throwCurlException($response['errorNumber'], $response['error']); |
@@ -351,8 +343,7 @@ discard block |
||
| 351 | 343 | * @param $request |
| 352 | 344 | * @param $response |
| 353 | 345 | */ |
| 354 | - private function logErrorDueToFailure($method, $uri, $request, $response) |
|
| 355 | - { |
|
| 346 | + private function logErrorDueToFailure($method, $uri, $request, $response) { |
|
| 356 | 347 | $this->logRequestFail( |
| 357 | 348 | $method, |
| 358 | 349 | $uri, |
@@ -370,8 +361,7 @@ discard block |
||
| 370 | 361 | * @param array $connectionParams |
| 371 | 362 | * @return array |
| 372 | 363 | */ |
| 373 | - private function transformAuth($connectionParams) |
|
| 374 | - { |
|
| 364 | + private function transformAuth($connectionParams) { |
|
| 375 | 365 | if (isset($connectionParams['auth']) !== true) { |
| 376 | 366 | return $connectionParams; |
| 377 | 367 | } |
@@ -411,8 +401,7 @@ discard block |
||
| 411 | 401 | * |
| 412 | 402 | * @return string |
| 413 | 403 | */ |
| 414 | - private function getURI($uri, $params) |
|
| 415 | - { |
|
| 404 | + private function getURI($uri, $params) { |
|
| 416 | 405 | $uri = $this->host . $uri; |
| 417 | 406 | |
| 418 | 407 | if (isset($params) === true) { |
@@ -422,8 +411,7 @@ discard block |
||
| 422 | 411 | return $uri; |
| 423 | 412 | } |
| 424 | 413 | |
| 425 | - private function generateCurlOpts($connectionParams) |
|
| 426 | - { |
|
| 414 | + private function generateCurlOpts($connectionParams) { |
|
| 427 | 415 | $opts = array( |
| 428 | 416 | CURLOPT_RETURNTRANSFER => true, |
| 429 | 417 | CURLOPT_TIMEOUT_MS => 1000, |
@@ -451,8 +439,7 @@ discard block |
||
| 451 | 439 | return $opts; |
| 452 | 440 | } |
| 453 | 441 | |
| 454 | - private function reconcileOptions($options) |
|
| 455 | - { |
|
| 442 | + private function reconcileOptions($options) { |
|
| 456 | 443 | $opts = array(); |
| 457 | 444 | if (isset($options['timeout']) === true) { |
| 458 | 445 | $opts[CURLOPT_TIMEOUT_MS] = $options['timeout']; |
@@ -64,21 +64,21 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | parent::__construct($hostDetails, $connectionParams, $log, $trace); |
| 66 | 66 | |
| 67 | - if (extension_loaded('curl') !== true) { |
|
| 67 | + if (extension_loaded('curl') !== TRUE) { |
|
| 68 | 68 | $log->critical('Curl library/extension is required for CurlMultiConnection.'); |
| 69 | 69 | throw new RuntimeException('Curl library/extension is required for CurlMultiConnection.'); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if (isset($connectionParams['curlMultiHandle']) !== true) { |
|
| 72 | + if (isset($connectionParams['curlMultiHandle']) !== TRUE) { |
|
| 73 | 73 | $log->critical('curlMultiHandle must be set in connectionParams'); |
| 74 | 74 | throw new InvalidArgumentException('curlMultiHandle must be set in connectionParams'); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (isset($hostDetails['port']) !== true) { |
|
| 77 | + if (isset($hostDetails['port']) !== TRUE) { |
|
| 78 | 78 | $hostDetails['port'] = 9200; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (isset($hostDetails['scheme']) !== true) { |
|
| 81 | + if (isset($hostDetails['scheme']) !== TRUE) { |
|
| 82 | 82 | $hostDetails['scheme'] = 'http'; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * @throws \Elasticsearch\Common\Exceptions\ServerErrorResponseException |
| 117 | 117 | * @return array |
| 118 | 118 | */ |
| 119 | - public function performRequest($method, $uri, $params = null, $body = null, $options = array()) |
|
| 119 | + public function performRequest($method, $uri, $params = NULL, $body = NULL, $options = array()) |
|
| 120 | 120 | { |
| 121 | 121 | $curlHandle = curl_init(); |
| 122 | 122 | $opts = $this->curlOpts; |
| 123 | 123 | $perRequestCurlOpts = array(); |
| 124 | 124 | |
| 125 | - if (isset($params['curlOpts']) === true) { |
|
| 125 | + if (isset($params['curlOpts']) === TRUE) { |
|
| 126 | 126 | $perRequestCurlOpts = $params['curlOpts']; |
| 127 | 127 | unset($params['curlOpts']); |
| 128 | 128 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $opts[CURLOPT_URL] = $uri; |
| 133 | 133 | |
| 134 | - if (isset($opts[CURLOPT_CUSTOMREQUEST]) !== true) { |
|
| 134 | + if (isset($opts[CURLOPT_CUSTOMREQUEST]) !== TRUE) { |
|
| 135 | 135 | $opts[CURLOPT_CUSTOMREQUEST]= $method; |
| 136 | 136 | } |
| 137 | 137 | |
@@ -141,12 +141,12 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | if ($method === 'GET') { |
| 143 | 143 | //Force these since Curl won't reset by itself |
| 144 | - $opts[CURLOPT_NOBODY] = false; |
|
| 144 | + $opts[CURLOPT_NOBODY] = FALSE; |
|
| 145 | 145 | } else if ($method === 'HEAD') { |
| 146 | - $opts[CURLOPT_NOBODY] = true; |
|
| 146 | + $opts[CURLOPT_NOBODY] = TRUE; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if (isset($body) === true) { |
|
| 149 | + if (isset($body) === TRUE) { |
|
| 150 | 150 | $opts[CURLOPT_POSTFIELDS] = $body; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | $exceptionText = "$statusCode Server Exception: $exceptionText\n$responseBody"; |
| 281 | 281 | |
| 282 | - if ($statusCode === 400 && strpos($responseBody, "AlreadyExpiredException") !== false) { |
|
| 282 | + if ($statusCode === 400 && strpos($responseBody, "AlreadyExpiredException") !== FALSE) { |
|
| 283 | 283 | throw new AlreadyExpiredException($responseBody, $statusCode); |
| 284 | 284 | } elseif ($statusCode === 401) { |
| 285 | 285 | throw new Authentication401Exception($responseBody, $statusCode); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | throw new Missing404Exception($responseBody, $statusCode); |
| 290 | 290 | } elseif ($statusCode === 409) { |
| 291 | 291 | throw new Conflict409Exception($responseBody, $statusCode); |
| 292 | - } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { |
|
| 292 | + } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== FALSE) { |
|
| 293 | 293 | throw new ScriptLangNotSupportedException($responseBody. $statusCode); |
| 294 | 294 | } elseif ($statusCode === 400) { |
| 295 | 295 | throw new BadRequest400Exception($responseBody, $statusCode); |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | $exceptionText = "$statusCode Server Exception: $exceptionText\n$responseBody"; |
| 319 | 319 | $this->log->error($exceptionText); |
| 320 | 320 | |
| 321 | - if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== false) { |
|
| 321 | + if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== FALSE) { |
|
| 322 | 322 | throw new RoutingMissingException($responseBody, $statusCode); |
| 323 | 323 | } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/',$responseBody) === 1) { |
| 324 | 324 | throw new NoDocumentsToGetException($responseBody, $statusCode); |
| 325 | - } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) { |
|
| 325 | + } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== FALSE) { |
|
| 326 | 326 | throw new NoShardAvailableException($responseBody, $statusCode); |
| 327 | 327 | } else { |
| 328 | 328 | throw new ServerErrorResponseException($responseBody, $statusCode); |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | private function transformAuth($connectionParams) |
| 374 | 374 | { |
| 375 | - if (isset($connectionParams['auth']) !== true) { |
|
| 375 | + if (isset($connectionParams['auth']) !== TRUE) { |
|
| 376 | 376 | return $connectionParams; |
| 377 | 377 | } |
| 378 | 378 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | { |
| 416 | 416 | $uri = $this->host . $uri; |
| 417 | 417 | |
| 418 | - if (isset($params) === true) { |
|
| 418 | + if (isset($params) === TRUE) { |
|
| 419 | 419 | $uri .= '?' . http_build_query($params); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -425,20 +425,20 @@ discard block |
||
| 425 | 425 | private function generateCurlOpts($connectionParams) |
| 426 | 426 | { |
| 427 | 427 | $opts = array( |
| 428 | - CURLOPT_RETURNTRANSFER => true, |
|
| 428 | + CURLOPT_RETURNTRANSFER => TRUE, |
|
| 429 | 429 | CURLOPT_TIMEOUT_MS => 1000, |
| 430 | 430 | CURLOPT_CONNECTTIMEOUT_MS => 1000, |
| 431 | - CURLOPT_HEADER => false, |
|
| 432 | - CURLOPT_SSL_VERIFYPEER => true, |
|
| 431 | + CURLOPT_HEADER => FALSE, |
|
| 432 | + CURLOPT_SSL_VERIFYPEER => TRUE, |
|
| 433 | 433 | CURLOPT_SSL_VERIFYHOST => 2, |
| 434 | - CURLOPT_TCP_NODELAY => false |
|
| 434 | + CURLOPT_TCP_NODELAY => FALSE |
|
| 435 | 435 | ); |
| 436 | 436 | |
| 437 | 437 | if (isset($this->headers) && count($this->headers) > 0) { |
| 438 | 438 | $opts[CURLOPT_HTTPHEADER] = $this->headers; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - if (isset($connectionParams['timeout']) === true) { |
|
| 441 | + if (isset($connectionParams['timeout']) === TRUE) { |
|
| 442 | 442 | $opts[CURLOPT_TIMEOUT_MS] = $connectionParams['timeout']; |
| 443 | 443 | $opts[CURLOPT_CONNECTTIMEOUT_MS] = $connectionParams['timeout']; |
| 444 | 444 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | private function reconcileOptions($options) |
| 455 | 455 | { |
| 456 | 456 | $opts = array(); |
| 457 | - if (isset($options['timeout']) === true) { |
|
| 457 | + if (isset($options['timeout']) === TRUE) { |
|
| 458 | 458 | $opts[CURLOPT_TIMEOUT_MS] = $options['timeout']; |
| 459 | 459 | $opts[CURLOPT_CONNECTTIMEOUT_MS] = $options['timeout']; |
| 460 | 460 | } |
@@ -203,7 +203,7 @@ |
||
| 203 | 203 | $this->process4xxError($request, $exception, $body); |
| 204 | 204 | |
| 205 | 205 | } catch (CurlException $exception) { |
| 206 | - $this->processCurlError($exception); |
|
| 206 | + $this->processCurlError($exception); |
|
| 207 | 207 | |
| 208 | 208 | } catch (\Exception $exception) { |
| 209 | 209 | $error = 'Unexpected error: ' . $exception->getMessage(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** @var Client */ |
| 35 | 35 | private $guzzle; |
| 36 | 36 | |
| 37 | - private $lastRequest = array(); |
|
| 37 | + private $lastRequest = array (); |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return array |
| 96 | 96 | */ |
| 97 | - public function performRequest($method, $uri, $params = null, $body = null, $options = array()) |
|
| 97 | + public function performRequest($method, $uri, $params = null, $body = null, $options = array ()) |
|
| 98 | 98 | { |
| 99 | 99 | |
| 100 | 100 | $uri = $this->getURI($uri, $params); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $request = $this->buildGuzzleRequest($method, $uri, $body, $options); |
| 104 | 104 | $response = $this->sendRequest($request, $body); |
| 105 | 105 | |
| 106 | - return array( |
|
| 106 | + return array ( |
|
| 107 | 107 | 'status' => $response->getStatusCode(), |
| 108 | 108 | 'text' => $response->getBody(true), |
| 109 | 109 | 'info' => $response->getInfo(), |
@@ -147,14 +147,14 @@ discard block |
||
| 147 | 147 | * |
| 148 | 148 | * @return Request |
| 149 | 149 | */ |
| 150 | - private function buildGuzzleRequest($method, $uri, $body, $options = array()) |
|
| 150 | + private function buildGuzzleRequest($method, $uri, $body, $options = array ()) |
|
| 151 | 151 | { |
| 152 | 152 | if ($method === 'GET' && isset($body) === true) { |
| 153 | 153 | $method = 'POST'; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if (isset($body) === true) { |
| 157 | - $this->lastRequest = array( 'request' => array( |
|
| 157 | + $this->lastRequest = array ('request' => array ( |
|
| 158 | 158 | 'uri' => $uri, |
| 159 | 159 | 'body' => $body, |
| 160 | 160 | 'options' => $options, |
@@ -162,21 +162,21 @@ discard block |
||
| 162 | 162 | )); |
| 163 | 163 | |
| 164 | 164 | /** @var EntityEnclosingRequest $request */ |
| 165 | - $request = $this->guzzle->$method($uri, array('content-type' => 'application/json'), $body, $options); |
|
| 165 | + $request = $this->guzzle->$method($uri, array ('content-type' => 'application/json'), $body, $options); |
|
| 166 | 166 | if (isset($options['auth'])) { |
| 167 | - $request->setAuth($options['auth'][0],$options['auth'][1],$options['auth'][2]); |
|
| 167 | + $request->setAuth($options['auth'][0], $options['auth'][1], $options['auth'][2]); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | } else { |
| 171 | - $this->lastRequest = array( 'request' => array( |
|
| 171 | + $this->lastRequest = array ('request' => array ( |
|
| 172 | 172 | 'uri' => $uri, |
| 173 | 173 | 'body' => null, |
| 174 | 174 | 'options' => $options, |
| 175 | 175 | 'method' => $method |
| 176 | 176 | )); |
| 177 | - $request = $this->guzzle->$method($uri, array(), array(), $options); |
|
| 177 | + $request = $this->guzzle->$method($uri, array (), array (), $options); |
|
| 178 | 178 | if (isset($options['auth'])) { |
| 179 | - $request->setAuth($options['auth'][0],$options['auth'][1],$options['auth'][2]); |
|
| 179 | + $request->setAuth($options['auth'][0], $options['auth'][1], $options['auth'][2]); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== false) { |
| 241 | 241 | throw new RoutingMissingException($responseBody, $statusCode, $exception); |
| 242 | - } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/',$responseBody) === 1) { |
|
| 242 | + } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/', $responseBody) === 1) { |
|
| 243 | 243 | throw new NoDocumentsToGetException($responseBody, $statusCode, $exception); |
| 244 | 244 | } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) { |
| 245 | 245 | throw new NoShardAvailableException($responseBody, $statusCode, $exception); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } elseif ($statusCode === 409) { |
| 273 | 273 | throw new Conflict409Exception($responseBody, $statusCode, $exception); |
| 274 | 274 | } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { |
| 275 | - throw new ScriptLangNotSupportedException($responseBody. $statusCode); |
|
| 275 | + throw new ScriptLangNotSupportedException($responseBody . $statusCode); |
|
| 276 | 276 | } elseif ($statusCode === 400) { |
| 277 | 277 | throw new BadRequest400Exception($responseBody, $statusCode, $exception); |
| 278 | 278 | } |
@@ -29,8 +29,7 @@ discard block |
||
| 29 | 29 | use Guzzle\Http\Message\Response; |
| 30 | 30 | use Psr\Log\LoggerInterface; |
| 31 | 31 | |
| 32 | -class GuzzleConnection extends AbstractConnection implements ConnectionInterface |
|
| 33 | -{ |
|
| 32 | +class GuzzleConnection extends AbstractConnection implements ConnectionInterface { |
|
| 34 | 33 | /** @var Client */ |
| 35 | 34 | private $guzzle; |
| 36 | 35 | |
@@ -46,8 +45,7 @@ discard block |
||
| 46 | 45 | * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException |
| 47 | 46 | * @return \Elasticsearch\Connections\GuzzleConnection |
| 48 | 47 | */ |
| 49 | - public function __construct($hostDetails, $connectionParams, LoggerInterface $log, LoggerInterface $trace) |
|
| 50 | - { |
|
| 48 | + public function __construct($hostDetails, $connectionParams, LoggerInterface $log, LoggerInterface $trace) { |
|
| 51 | 49 | if (isset($connectionParams['guzzleClient']) !== true) { |
| 52 | 50 | $log->critical('guzzleClient must be set in connectionParams'); |
| 53 | 51 | throw new InvalidArgumentException('guzzleClient must be set in connectionParams'); |
@@ -77,8 +75,7 @@ discard block |
||
| 77 | 75 | * |
| 78 | 76 | * @return string |
| 79 | 77 | */ |
| 80 | - public function getTransportSchema() |
|
| 81 | - { |
|
| 78 | + public function getTransportSchema() { |
|
| 82 | 79 | return $this->transportSchema; |
| 83 | 80 | } |
| 84 | 81 | |
@@ -94,8 +91,7 @@ discard block |
||
| 94 | 91 | * |
| 95 | 92 | * @return array |
| 96 | 93 | */ |
| 97 | - public function performRequest($method, $uri, $params = null, $body = null, $options = array()) |
|
| 98 | - { |
|
| 94 | + public function performRequest($method, $uri, $params = null, $body = null, $options = array()) { |
|
| 99 | 95 | |
| 100 | 96 | $uri = $this->getURI($uri, $params); |
| 101 | 97 | |
@@ -115,8 +111,7 @@ discard block |
||
| 115 | 111 | /** |
| 116 | 112 | * @return array |
| 117 | 113 | */ |
| 118 | - public function getLastRequestInfo() |
|
| 119 | - { |
|
| 114 | + public function getLastRequestInfo() { |
|
| 120 | 115 | return $this->lastRequest; |
| 121 | 116 | } |
| 122 | 117 | |
@@ -127,8 +122,7 @@ discard block |
||
| 127 | 122 | * |
| 128 | 123 | * @return string |
| 129 | 124 | */ |
| 130 | - private function getURI($uri, $params) |
|
| 131 | - { |
|
| 125 | + private function getURI($uri, $params) { |
|
| 132 | 126 | $uri = $this->host . $uri; |
| 133 | 127 | |
| 134 | 128 | if (isset($params) === true) { |
@@ -147,8 +141,7 @@ discard block |
||
| 147 | 141 | * |
| 148 | 142 | * @return Request |
| 149 | 143 | */ |
| 150 | - private function buildGuzzleRequest($method, $uri, $body, $options = array()) |
|
| 151 | - { |
|
| 144 | + private function buildGuzzleRequest($method, $uri, $body, $options = array()) { |
|
| 152 | 145 | if ($method === 'GET' && isset($body) === true) { |
| 153 | 146 | $method = 'POST'; |
| 154 | 147 | } |
@@ -192,8 +185,7 @@ discard block |
||
| 192 | 185 | * @throws \Elasticsearch\Common\Exceptions\TransportException |
| 193 | 186 | * @return \Guzzle\Http\Message\Response |
| 194 | 187 | */ |
| 195 | - private function sendRequest(Request $request, $body) |
|
| 196 | - { |
|
| 188 | + private function sendRequest(Request $request, $body) { |
|
| 197 | 189 | try { |
| 198 | 190 | $request->send(); |
| 199 | 191 | } catch (ServerErrorResponseException $exception) { |
@@ -226,8 +218,7 @@ discard block |
||
| 226 | 218 | * @throws \Guzzle\Http\Exception\ServerErrorResponseException |
| 227 | 219 | * @throws \Elasticsearch\Common\Exceptions\NoDocumentsToGetException |
| 228 | 220 | */ |
| 229 | - private function process5xxError(Request $request, ServerErrorResponseException $exception, $body) |
|
| 230 | - { |
|
| 221 | + private function process5xxError(Request $request, ServerErrorResponseException $exception, $body) { |
|
| 231 | 222 | $this->logErrorDueToFailure($request, $exception, $body); |
| 232 | 223 | |
| 233 | 224 | $statusCode = $request->getResponse()->getStatusCode(); |
@@ -251,8 +242,7 @@ discard block |
||
| 251 | 242 | } |
| 252 | 243 | |
| 253 | 244 | |
| 254 | - private function process4xxError(Request $request, ClientErrorResponseException $exception, $body) |
|
| 255 | - { |
|
| 245 | + private function process4xxError(Request $request, ClientErrorResponseException $exception, $body) { |
|
| 256 | 246 | $this->logErrorDueToFailure($request, $exception, $body); |
| 257 | 247 | |
| 258 | 248 | $statusCode = $request->getResponse()->getStatusCode(); |
@@ -284,8 +274,7 @@ discard block |
||
| 284 | 274 | * @param \Exception $exception |
| 285 | 275 | * @param string $body |
| 286 | 276 | */ |
| 287 | - private function logErrorDueToFailure(Request $request, \Exception $exception, $body) |
|
| 288 | - { |
|
| 277 | + private function logErrorDueToFailure(Request $request, \Exception $exception, $body) { |
|
| 289 | 278 | $response = $request->getResponse(); |
| 290 | 279 | $headers = $request->getHeaders()->getAll(); |
| 291 | 280 | $info = $response->getInfo(); |
@@ -312,8 +301,7 @@ discard block |
||
| 312 | 301 | /** |
| 313 | 302 | * @param CurlException $exception\ |
| 314 | 303 | */ |
| 315 | - private function processCurlError(CurlException $exception) |
|
| 316 | - { |
|
| 304 | + private function processCurlError(CurlException $exception) { |
|
| 317 | 305 | $error = 'Curl error: ' . $exception->getMessage(); |
| 318 | 306 | $this->log->error($error); |
| 319 | 307 | $this->throwCurlException($exception->getErrorNo(), $exception->getError()); |
@@ -323,8 +311,7 @@ discard block |
||
| 323 | 311 | * @param Request $request |
| 324 | 312 | * @param string $body |
| 325 | 313 | */ |
| 326 | - private function processSuccessfulRequest(Request $request, $body) |
|
| 327 | - { |
|
| 314 | + private function processSuccessfulRequest(Request $request, $body) { |
|
| 328 | 315 | $response = $request->getResponse(); |
| 329 | 316 | $headers = $request->getHeaders()->getAll(); |
| 330 | 317 | $responseBody = $response->getBody(true); |
@@ -48,16 +48,16 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function __construct($hostDetails, $connectionParams, LoggerInterface $log, LoggerInterface $trace) |
| 50 | 50 | { |
| 51 | - if (isset($connectionParams['guzzleClient']) !== true) { |
|
| 51 | + if (isset($connectionParams['guzzleClient']) !== TRUE) { |
|
| 52 | 52 | $log->critical('guzzleClient must be set in connectionParams'); |
| 53 | 53 | throw new InvalidArgumentException('guzzleClient must be set in connectionParams'); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (isset($hostDetails['port']) !== true) { |
|
| 56 | + if (isset($hostDetails['port']) !== TRUE) { |
|
| 57 | 57 | $hostDetails['port'] = 9200; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if (isset($hostDetails['scheme']) !== true) { |
|
| 60 | + if (isset($hostDetails['scheme']) !== TRUE) { |
|
| 61 | 61 | $hostDetails['scheme'] = 'http'; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return array |
| 96 | 96 | */ |
| 97 | - public function performRequest($method, $uri, $params = null, $body = null, $options = array()) |
|
| 97 | + public function performRequest($method, $uri, $params = NULL, $body = NULL, $options = array()) |
|
| 98 | 98 | { |
| 99 | 99 | |
| 100 | 100 | $uri = $this->getURI($uri, $params); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | return array( |
| 107 | 107 | 'status' => $response->getStatusCode(), |
| 108 | - 'text' => $response->getBody(true), |
|
| 108 | + 'text' => $response->getBody(TRUE), |
|
| 109 | 109 | 'info' => $response->getInfo(), |
| 110 | 110 | ); |
| 111 | 111 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $uri = $this->host . $uri; |
| 133 | 133 | |
| 134 | - if (isset($params) === true) { |
|
| 134 | + if (isset($params) === TRUE) { |
|
| 135 | 135 | $uri .= '?' . http_build_query($params); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -149,11 +149,11 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | private function buildGuzzleRequest($method, $uri, $body, $options = array()) |
| 151 | 151 | { |
| 152 | - if ($method === 'GET' && isset($body) === true) { |
|
| 152 | + if ($method === 'GET' && isset($body) === TRUE) { |
|
| 153 | 153 | $method = 'POST'; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (isset($body) === true) { |
|
| 156 | + if (isset($body) === TRUE) { |
|
| 157 | 157 | $this->lastRequest = array( 'request' => array( |
| 158 | 158 | 'uri' => $uri, |
| 159 | 159 | 'body' => $body, |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } else { |
| 171 | 171 | $this->lastRequest = array( 'request' => array( |
| 172 | 172 | 'uri' => $uri, |
| 173 | - 'body' => null, |
|
| 173 | + 'body' => NULL, |
|
| 174 | 174 | 'options' => $options, |
| 175 | 175 | 'method' => $method |
| 176 | 176 | )); |
@@ -232,16 +232,16 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $statusCode = $request->getResponse()->getStatusCode(); |
| 234 | 234 | $exceptionText = $exception->getMessage(); |
| 235 | - $responseBody = $request->getResponse()->getBody(true); |
|
| 235 | + $responseBody = $request->getResponse()->getBody(TRUE); |
|
| 236 | 236 | |
| 237 | 237 | $exceptionText = "$statusCode Server Exception: $exceptionText\n$responseBody"; |
| 238 | 238 | $this->log->error($exceptionText); |
| 239 | 239 | |
| 240 | - if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== false) { |
|
| 240 | + if ($statusCode === 500 && strpos($responseBody, "RoutingMissingException") !== FALSE) { |
|
| 241 | 241 | throw new RoutingMissingException($responseBody, $statusCode, $exception); |
| 242 | 242 | } elseif ($statusCode === 500 && preg_match('/ActionRequestValidationException.+ no documents to get/',$responseBody) === 1) { |
| 243 | 243 | throw new NoDocumentsToGetException($responseBody, $statusCode, $exception); |
| 244 | - } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== false) { |
|
| 244 | + } elseif ($statusCode === 500 && strpos($responseBody, 'NoShardAvailableActionException') !== FALSE) { |
|
| 245 | 245 | throw new NoShardAvailableException($responseBody, $statusCode, $exception); |
| 246 | 246 | } else { |
| 247 | 247 | throw new \Elasticsearch\Common\Exceptions\ServerErrorResponseException($responseBody, $statusCode, $exception); |
@@ -257,11 +257,11 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | $statusCode = $request->getResponse()->getStatusCode(); |
| 259 | 259 | $exceptionText = $exception->getMessage(); |
| 260 | - $responseBody = $request->getResponse()->getBody(true); |
|
| 260 | + $responseBody = $request->getResponse()->getBody(TRUE); |
|
| 261 | 261 | |
| 262 | 262 | $exceptionText = "$statusCode Server Exception: $exceptionText\n$responseBody"; |
| 263 | 263 | |
| 264 | - if ($statusCode === 400 && strpos($responseBody, "AlreadyExpiredException") !== false) { |
|
| 264 | + if ($statusCode === 400 && strpos($responseBody, "AlreadyExpiredException") !== FALSE) { |
|
| 265 | 265 | throw new AlreadyExpiredException($responseBody, $statusCode, $exception); |
| 266 | 266 | } elseif ($statusCode === 401) { |
| 267 | 267 | throw new Authentication401Exception($responseBody, $statusCode, $exception); |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | throw new Missing404Exception($responseBody, $statusCode, $exception); |
| 272 | 272 | } elseif ($statusCode === 409) { |
| 273 | 273 | throw new Conflict409Exception($responseBody, $statusCode, $exception); |
| 274 | - } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== false) { |
|
| 274 | + } elseif ($statusCode === 400 && strpos($responseBody, 'script_lang not supported') !== FALSE) { |
|
| 275 | 275 | throw new ScriptLangNotSupportedException($responseBody. $statusCode); |
| 276 | 276 | } elseif ($statusCode === 400) { |
| 277 | 277 | throw new BadRequest400Exception($responseBody, $statusCode, $exception); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $response = $request->getResponse(); |
| 290 | 290 | $headers = $request->getHeaders()->getAll(); |
| 291 | 291 | $info = $response->getInfo(); |
| 292 | - $responseBody = $response->getBody(true); |
|
| 292 | + $responseBody = $response->getBody(TRUE); |
|
| 293 | 293 | $status = $response->getStatusCode(); |
| 294 | 294 | |
| 295 | 295 | $this->lastRequest['response']['body'] = $responseBody; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | { |
| 328 | 328 | $response = $request->getResponse(); |
| 329 | 329 | $headers = $request->getHeaders()->getAll(); |
| 330 | - $responseBody = $response->getBody(true); |
|
| 330 | + $responseBody = $response->getBody(TRUE); |
|
| 331 | 331 | $status = $response->getStatusCode(); |
| 332 | 332 | |
| 333 | 333 | $this->lastRequest['response']['body'] = $responseBody; |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | /** @var \Elasticsearch\Endpoints\Snapshot\Create $endpoint */ |
| 39 | 39 | $endpoint = $endpointBuilder('Snapshot\Create'); |
| 40 | 40 | $endpoint->setRepository($repository) |
| 41 | - ->setSnapshot($snapshot) |
|
| 42 | - ->setParams($params) |
|
| 43 | - ->setBody($body); |
|
| 41 | + ->setSnapshot($snapshot) |
|
| 42 | + ->setParams($params) |
|
| 43 | + ->setBody($body); |
|
| 44 | 44 | $response = $endpoint->performRequest(); |
| 45 | 45 | return $response['data']; |
| 46 | 46 | } |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Create $endpoint */ |
| 66 | 66 | $endpoint = $endpointBuilder('Snapshot\Repository\Create'); |
| 67 | 67 | $endpoint->setRepository($repository) |
| 68 | - ->setBody($body) |
|
| 69 | - ->setParams($params); |
|
| 68 | + ->setBody($body) |
|
| 69 | + ->setParams($params); |
|
| 70 | 70 | $response = $endpoint->performRequest(); |
| 71 | 71 | return $response['data']; |
| 72 | 72 | } |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | /** @var \Elasticsearch\Endpoints\Snapshot\Delete $endpoint */ |
| 91 | 91 | $endpoint = $endpointBuilder('Snapshot\Delete'); |
| 92 | 92 | $endpoint->setRepository($repository) |
| 93 | - ->setSnapshot($snapshot) |
|
| 94 | - ->setParams($params); |
|
| 93 | + ->setSnapshot($snapshot) |
|
| 94 | + ->setParams($params); |
|
| 95 | 95 | $response = $endpoint->performRequest(); |
| 96 | 96 | return $response['data']; |
| 97 | 97 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Delete $endpoint */ |
| 116 | 116 | $endpoint = $endpointBuilder('Snapshot\Repository\Delete'); |
| 117 | 117 | $endpoint->setRepository($repository) |
| 118 | - ->setParams($params); |
|
| 118 | + ->setParams($params); |
|
| 119 | 119 | $response = $endpoint->performRequest(); |
| 120 | 120 | return $response['data']; |
| 121 | 121 | } |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | /** @var \Elasticsearch\Endpoints\Snapshot\Get $endpoint */ |
| 142 | 142 | $endpoint = $endpointBuilder('Snapshot\Get'); |
| 143 | 143 | $endpoint->setRepository($repository) |
| 144 | - ->setSnapshot($snapshot) |
|
| 145 | - ->setParams($params); |
|
| 144 | + ->setSnapshot($snapshot) |
|
| 145 | + ->setParams($params); |
|
| 146 | 146 | $response = $endpoint->performRequest(); |
| 147 | 147 | return $response['data']; |
| 148 | 148 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Get $endpoint */ |
| 167 | 167 | $endpoint = $endpointBuilder('Snapshot\Repository\Get'); |
| 168 | 168 | $endpoint->setRepository($repository) |
| 169 | - ->setParams($params); |
|
| 169 | + ->setParams($params); |
|
| 170 | 170 | $response = $endpoint->performRequest(); |
| 171 | 171 | return $response['data']; |
| 172 | 172 | } |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | /** @var \Elasticsearch\Endpoints\Snapshot\Restore $endpoint */ |
| 193 | 193 | $endpoint = $endpointBuilder('Snapshot\Restore'); |
| 194 | 194 | $endpoint->setRepository($repository) |
| 195 | - ->setSnapshot($snapshot) |
|
| 196 | - ->setParams($params) |
|
| 197 | - ->setBody($body); |
|
| 195 | + ->setSnapshot($snapshot) |
|
| 196 | + ->setParams($params) |
|
| 197 | + ->setBody($body); |
|
| 198 | 198 | $response = $endpoint->performRequest(); |
| 199 | 199 | return $response['data']; |
| 200 | 200 | } |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | /** @var \Elasticsearch\Endpoints\Snapshot\Status $endpoint */ |
| 218 | 218 | $endpoint = $endpointBuilder('Snapshot\Status'); |
| 219 | 219 | $endpoint->setRepository($repository) |
| 220 | - ->setSnapshot($snapshot) |
|
| 221 | - ->setParams($params); |
|
| 220 | + ->setSnapshot($snapshot) |
|
| 221 | + ->setParams($params); |
|
| 222 | 222 | $response = $endpoint->performRequest(); |
| 223 | 223 | return $response['data']; |
| 224 | 224 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Verify $endpoint */ |
| 242 | 242 | $endpoint = $endpointBuilder('Snapshot\Repository\Verify'); |
| 243 | 243 | $endpoint->setRepository($repository) |
| 244 | - ->setParams($params); |
|
| 244 | + ->setParams($params); |
|
| 245 | 245 | $response = $endpoint->performRequest(); |
| 246 | 246 | return $response['data']; |
| 247 | 247 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return array |
| 28 | 28 | */ |
| 29 | - public function create($params = array()) |
|
| 29 | + public function create($params = array ()) |
|
| 30 | 30 | { |
| 31 | 31 | $repository = $this->extractArgument($params, 'repository'); |
| 32 | 32 | $snapshot = $this->extractArgument($params, 'snapshot'); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return array |
| 56 | 56 | */ |
| 57 | - public function createRepository($params = array()) |
|
| 57 | + public function createRepository($params = array ()) |
|
| 58 | 58 | { |
| 59 | 59 | $repository = $this->extractArgument($params, 'repository'); |
| 60 | 60 | $body = $this->extractArgument($params, 'body'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return array |
| 81 | 81 | */ |
| 82 | - public function delete($params = array()) |
|
| 82 | + public function delete($params = array ()) |
|
| 83 | 83 | { |
| 84 | 84 | $repository = $this->extractArgument($params, 'repository'); |
| 85 | 85 | $snapshot = $this->extractArgument($params, 'snapshot'); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return array |
| 107 | 107 | */ |
| 108 | - public function deleteRepository($params = array()) |
|
| 108 | + public function deleteRepository($params = array ()) |
|
| 109 | 109 | { |
| 110 | 110 | $repository = $this->extractArgument($params, 'repository'); |
| 111 | 111 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return array |
| 130 | 130 | */ |
| 131 | - public function get($params = array()) |
|
| 131 | + public function get($params = array ()) |
|
| 132 | 132 | { |
| 133 | 133 | $repository = $this->extractArgument($params, 'repository'); |
| 134 | 134 | $snapshot = $this->extractArgument($params, 'snapshot'); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * |
| 157 | 157 | * @return array |
| 158 | 158 | */ |
| 159 | - public function getRepository($params = array()) |
|
| 159 | + public function getRepository($params = array ()) |
|
| 160 | 160 | { |
| 161 | 161 | $repository = $this->extractArgument($params, 'repository'); |
| 162 | 162 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return array |
| 182 | 182 | */ |
| 183 | - public function restore($params = array()) |
|
| 183 | + public function restore($params = array ()) |
|
| 184 | 184 | { |
| 185 | 185 | $repository = $this->extractArgument($params, 'repository'); |
| 186 | 186 | $snapshot = $this->extractArgument($params, 'snapshot'); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * |
| 207 | 207 | * @return array |
| 208 | 208 | */ |
| 209 | - public function status($params = array()) |
|
| 209 | + public function status($params = array ()) |
|
| 210 | 210 | { |
| 211 | 211 | $repository = $this->extractArgument($params, 'repository'); |
| 212 | 212 | $snapshot = $this->extractArgument($params, 'snapshot'); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array |
| 233 | 233 | */ |
| 234 | - public function verifyRepository($params = array()) |
|
| 234 | + public function verifyRepository($params = array ()) |
|
| 235 | 235 | { |
| 236 | 236 | $repository = $this->extractArgument($params, 'repository'); |
| 237 | 237 | |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 17 | 17 | * @link http://elasticsearch.org |
| 18 | 18 | */ |
| 19 | -class SnapshotNamespace extends AbstractNamespace |
|
| 20 | -{ |
|
| 19 | +class SnapshotNamespace extends AbstractNamespace { |
|
| 21 | 20 | /** |
| 22 | 21 | * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node |
| 23 | 22 | * ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning |
@@ -26,8 +25,7 @@ discard block |
||
| 26 | 25 | * |
| 27 | 26 | * @return array |
| 28 | 27 | */ |
| 29 | - public function create($params = array()) |
|
| 30 | - { |
|
| 28 | + public function create($params = array()) { |
|
| 31 | 29 | $repository = $this->extractArgument($params, 'repository'); |
| 32 | 30 | $snapshot = $this->extractArgument($params, 'snapshot'); |
| 33 | 31 | $body = $this->extractArgument($params, 'body'); |
@@ -54,8 +52,7 @@ discard block |
||
| 54 | 52 | * |
| 55 | 53 | * @return array |
| 56 | 54 | */ |
| 57 | - public function createRepository($params = array()) |
|
| 58 | - { |
|
| 55 | + public function createRepository($params = array()) { |
|
| 59 | 56 | $repository = $this->extractArgument($params, 'repository'); |
| 60 | 57 | $body = $this->extractArgument($params, 'body'); |
| 61 | 58 | |
@@ -79,8 +76,7 @@ discard block |
||
| 79 | 76 | * |
| 80 | 77 | * @return array |
| 81 | 78 | */ |
| 82 | - public function delete($params = array()) |
|
| 83 | - { |
|
| 79 | + public function delete($params = array()) { |
|
| 84 | 80 | $repository = $this->extractArgument($params, 'repository'); |
| 85 | 81 | $snapshot = $this->extractArgument($params, 'snapshot'); |
| 86 | 82 | |
@@ -105,8 +101,7 @@ discard block |
||
| 105 | 101 | * |
| 106 | 102 | * @return array |
| 107 | 103 | */ |
| 108 | - public function deleteRepository($params = array()) |
|
| 109 | - { |
|
| 104 | + public function deleteRepository($params = array()) { |
|
| 110 | 105 | $repository = $this->extractArgument($params, 'repository'); |
| 111 | 106 | |
| 112 | 107 | /** @var callback $endpointBuilder */ |
@@ -128,8 +123,7 @@ discard block |
||
| 128 | 123 | * |
| 129 | 124 | * @return array |
| 130 | 125 | */ |
| 131 | - public function get($params = array()) |
|
| 132 | - { |
|
| 126 | + public function get($params = array()) { |
|
| 133 | 127 | $repository = $this->extractArgument($params, 'repository'); |
| 134 | 128 | $snapshot = $this->extractArgument($params, 'snapshot'); |
| 135 | 129 | |
@@ -156,8 +150,7 @@ discard block |
||
| 156 | 150 | * |
| 157 | 151 | * @return array |
| 158 | 152 | */ |
| 159 | - public function getRepository($params = array()) |
|
| 160 | - { |
|
| 153 | + public function getRepository($params = array()) { |
|
| 161 | 154 | $repository = $this->extractArgument($params, 'repository'); |
| 162 | 155 | |
| 163 | 156 | /** @var callback $endpointBuilder */ |
@@ -180,8 +173,7 @@ discard block |
||
| 180 | 173 | * |
| 181 | 174 | * @return array |
| 182 | 175 | */ |
| 183 | - public function restore($params = array()) |
|
| 184 | - { |
|
| 176 | + public function restore($params = array()) { |
|
| 185 | 177 | $repository = $this->extractArgument($params, 'repository'); |
| 186 | 178 | $snapshot = $this->extractArgument($params, 'snapshot'); |
| 187 | 179 | $body = $this->extractArgument($params, 'body'); |
@@ -206,8 +198,7 @@ discard block |
||
| 206 | 198 | * |
| 207 | 199 | * @return array |
| 208 | 200 | */ |
| 209 | - public function status($params = array()) |
|
| 210 | - { |
|
| 201 | + public function status($params = array()) { |
|
| 211 | 202 | $repository = $this->extractArgument($params, 'repository'); |
| 212 | 203 | $snapshot = $this->extractArgument($params, 'snapshot'); |
| 213 | 204 | |
@@ -231,8 +222,7 @@ discard block |
||
| 231 | 222 | * |
| 232 | 223 | * @return array |
| 233 | 224 | */ |
| 234 | - public function verifyRepository($params = array()) |
|
| 235 | - { |
|
| 225 | + public function verifyRepository($params = array()) { |
|
| 236 | 226 | $repository = $this->extractArgument($params, 'repository'); |
| 237 | 227 | |
| 238 | 228 | /** @var callback $endpointBuilder */ |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | public function extractArgument(&$params, $arg) |
| 51 | 51 | { |
| 52 | 52 | if (is_object($params) === true) { |
| 53 | - $params = (array)$params; |
|
| 53 | + $params = (array) $params; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if (isset($params[$arg]) === true) { |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 20 | 20 | * @link http://elasticsearch.org |
| 21 | 21 | */ |
| 22 | -abstract class AbstractNamespace |
|
| 23 | -{ |
|
| 22 | +abstract class AbstractNamespace { |
|
| 24 | 23 | /** @var \Elasticsearch\Transport */ |
| 25 | 24 | protected $transport; |
| 26 | 25 | |
@@ -34,8 +33,7 @@ discard block |
||
| 34 | 33 | * @param Transport $transport Transport object |
| 35 | 34 | * @param $dicEndpoints |
| 36 | 35 | */ |
| 37 | - public function __construct($transport, $dicEndpoints) |
|
| 38 | - { |
|
| 36 | + public function __construct($transport, $dicEndpoints) { |
|
| 39 | 37 | $this->transport = $transport; |
| 40 | 38 | $this->dicEndpoints = $dicEndpoints; |
| 41 | 39 | } |
@@ -47,8 +45,7 @@ discard block |
||
| 47 | 45 | * |
| 48 | 46 | * @return null|mixed |
| 49 | 47 | */ |
| 50 | - public function extractArgument(&$params, $arg) |
|
| 51 | - { |
|
| 48 | + public function extractArgument(&$params, $arg) { |
|
| 52 | 49 | if (is_object($params) === true) { |
| 53 | 50 | $params = (array)$params; |
| 54 | 51 | } |
@@ -49,16 +49,16 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function extractArgument(&$params, $arg) |
| 51 | 51 | { |
| 52 | - if (is_object($params) === true) { |
|
| 52 | + if (is_object($params) === TRUE) { |
|
| 53 | 53 | $params = (array)$params; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (isset($params[$arg]) === true) { |
|
| 56 | + if (isset($params[$arg]) === TRUE) { |
|
| 57 | 57 | $val = $params[$arg]; |
| 58 | 58 | unset($params[$arg]); |
| 59 | 59 | return $val; |
| 60 | 60 | } else { |
| 61 | - return null; |
|
| 61 | + return NULL; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | /** @var \Elasticsearch\Endpoints\Indices\Get $endpoint */ |
| 80 | 80 | $endpoint = $endpointBuilder('Indices\Get'); |
| 81 | 81 | $endpoint->setIndex($index) |
| 82 | - ->setFeature($feature) |
|
| 83 | - ->setParams($params); |
|
| 82 | + ->setFeature($feature) |
|
| 83 | + ->setParams($params); |
|
| 84 | 84 | |
| 85 | 85 | $response = $endpoint->performRequest(); |
| 86 | 86 | return $response['data']; |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | /** @var \Elasticsearch\Endpoints\Indices\Warmer\Delete $endpoint */ |
| 170 | 170 | $endpoint = $endpointBuilder('Indices\Warmer\Delete'); |
| 171 | 171 | $endpoint->setIndex($index) |
| 172 | - ->setName($name) |
|
| 173 | - ->setType($type); |
|
| 172 | + ->setName($name) |
|
| 173 | + ->setType($type); |
|
| 174 | 174 | $endpoint->setParams($params); |
| 175 | 175 | $response = $endpoint->performRequest(); |
| 176 | 176 | return $response['data']; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | /** @var \Elasticsearch\Endpoints\Indices\Stats $endpoint */ |
| 243 | 243 | $endpoint = $endpointBuilder('Indices\Stats'); |
| 244 | 244 | $endpoint->setIndex($index) |
| 245 | - ->setMetric($metric); |
|
| 245 | + ->setMetric($metric); |
|
| 246 | 246 | $endpoint->setParams($params); |
| 247 | 247 | $response = $endpoint->performRequest(); |
| 248 | 248 | return $response['data']; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | /** @var \Elasticsearch\Endpoints\Indices\Settings\Put $endpoint */ |
| 273 | 273 | $endpoint = $endpointBuilder('Indices\Settings\Put'); |
| 274 | 274 | $endpoint->setIndex($index) |
| 275 | - ->setBody($body); |
|
| 275 | + ->setBody($body); |
|
| 276 | 276 | $endpoint->setParams($params); |
| 277 | 277 | $response = $endpoint->performRequest(); |
| 278 | 278 | return $response['data']; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | /** @var \Elasticsearch\Endpoints\Indices\Mapping\Get $endpoint */ |
| 331 | 331 | $endpoint = $endpointBuilder('Indices\Mapping\Get'); |
| 332 | 332 | $endpoint->setIndex($index) |
| 333 | - ->setType($type); |
|
| 333 | + ->setType($type); |
|
| 334 | 334 | $endpoint->setParams($params); |
| 335 | 335 | $response = $endpoint->performRequest(); |
| 336 | 336 | return $response['data']; |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | /** @var \Elasticsearch\Endpoints\Indices\Mapping\GetField $endpoint */ |
| 362 | 362 | $endpoint = $endpointBuilder('Indices\Mapping\GetField'); |
| 363 | 363 | $endpoint->setIndex($index) |
| 364 | - ->setType($type) |
|
| 365 | - ->setField($field); |
|
| 364 | + ->setType($type) |
|
| 365 | + ->setField($field); |
|
| 366 | 366 | |
| 367 | 367 | $endpoint->setParams($params); |
| 368 | 368 | $response = $endpoint->performRequest(); |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | /** @var \Elasticsearch\Endpoints\Indices\Type\Exists $endpoint */ |
| 482 | 482 | $endpoint = $endpointBuilder('Indices\Type\Exists'); |
| 483 | 483 | $endpoint->setIndex($index) |
| 484 | - ->setType($type); |
|
| 484 | + ->setType($type); |
|
| 485 | 485 | $endpoint->setParams($params); |
| 486 | 486 | |
| 487 | 487 | try { |
@@ -527,8 +527,8 @@ discard block |
||
| 527 | 527 | /** @var \Elasticsearch\Endpoints\Indices\Alias\Put $endpoint */ |
| 528 | 528 | $endpoint = $endpointBuilder('Indices\Alias\Put'); |
| 529 | 529 | $endpoint->setIndex($index) |
| 530 | - ->setName($name) |
|
| 531 | - ->setBody($body); |
|
| 530 | + ->setName($name) |
|
| 531 | + ->setBody($body); |
|
| 532 | 532 | $endpoint->setParams($params); |
| 533 | 533 | $response = $endpoint->performRequest(); |
| 534 | 534 | return $response['data']; |
@@ -562,8 +562,8 @@ discard block |
||
| 562 | 562 | /** @var \Elasticsearch\Endpoints\Indices\Warmer\Get $endpoint */ |
| 563 | 563 | $endpoint = $endpointBuilder('Indices\Warmer\Get'); |
| 564 | 564 | $endpoint->setIndex($index) |
| 565 | - ->setName($name) |
|
| 566 | - ->setType($type); |
|
| 565 | + ->setName($name) |
|
| 566 | + ->setType($type); |
|
| 567 | 567 | $endpoint->setParams($params); |
| 568 | 568 | $response = $endpoint->performRequest(); |
| 569 | 569 | return $response['data']; |
@@ -601,9 +601,9 @@ discard block |
||
| 601 | 601 | /** @var \Elasticsearch\Endpoints\Indices\Warmer\Put $endpoint */ |
| 602 | 602 | $endpoint = $endpointBuilder('Indices\Warmer\Put'); |
| 603 | 603 | $endpoint->setIndex($index) |
| 604 | - ->setName($name) |
|
| 605 | - ->setType($type) |
|
| 606 | - ->setBody($body); |
|
| 604 | + ->setName($name) |
|
| 605 | + ->setType($type) |
|
| 606 | + ->setBody($body); |
|
| 607 | 607 | $endpoint->setParams($params); |
| 608 | 608 | $response = $endpoint->performRequest(); |
| 609 | 609 | return $response['data']; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | /** @var \Elasticsearch\Endpoints\Indices\Template\Put $endpoint */ |
| 637 | 637 | $endpoint = $endpointBuilder('Indices\Template\Put'); |
| 638 | 638 | $endpoint->setName($name) |
| 639 | - ->setBody($body); |
|
| 639 | + ->setBody($body); |
|
| 640 | 640 | $endpoint->setParams($params); |
| 641 | 641 | $response = $endpoint->performRequest(); |
| 642 | 642 | return $response['data']; |
@@ -674,8 +674,8 @@ discard block |
||
| 674 | 674 | /** @var \Elasticsearch\Endpoints\Indices\Validate\Query $endpoint */ |
| 675 | 675 | $endpoint = $endpointBuilder('Indices\Validate\Query'); |
| 676 | 676 | $endpoint->setIndex($index) |
| 677 | - ->setType($type) |
|
| 678 | - ->setBody($body); |
|
| 677 | + ->setType($type) |
|
| 678 | + ->setBody($body); |
|
| 679 | 679 | $endpoint->setParams($params); |
| 680 | 680 | $response = $endpoint->performRequest(); |
| 681 | 681 | return $response['data']; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | /** @var \Elasticsearch\Endpoints\Indices\Alias\Get $endpoint */ |
| 708 | 708 | $endpoint = $endpointBuilder('Indices\Alias\Get'); |
| 709 | 709 | $endpoint->setIndex($index) |
| 710 | - ->setName($name); |
|
| 710 | + ->setName($name); |
|
| 711 | 711 | $endpoint->setParams($params); |
| 712 | 712 | $response = $endpoint->performRequest(); |
| 713 | 713 | return $response['data']; |
@@ -742,8 +742,8 @@ discard block |
||
| 742 | 742 | /** @var \Elasticsearch\Endpoints\Indices\Mapping\Put $endpoint */ |
| 743 | 743 | $endpoint = $endpointBuilder('Indices\Mapping\Put'); |
| 744 | 744 | $endpoint->setIndex($index) |
| 745 | - ->setType($type) |
|
| 746 | - ->setBody($body); |
|
| 745 | + ->setType($type) |
|
| 746 | + ->setBody($body); |
|
| 747 | 747 | $endpoint->setParams($params); |
| 748 | 748 | $response = $endpoint->performRequest(); |
| 749 | 749 | return $response['data']; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | /** @var \Elasticsearch\Endpoints\Indices\Mapping\Delete $endpoint */ |
| 774 | 774 | $endpoint = $endpointBuilder('Indices\Mapping\Delete'); |
| 775 | 775 | $endpoint->setIndex($index) |
| 776 | - ->setType($type); |
|
| 776 | + ->setType($type); |
|
| 777 | 777 | $endpoint->setParams($params); |
| 778 | 778 | $response = $endpoint->performRequest(); |
| 779 | 779 | return $response['data']; |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | /** @var \Elasticsearch\Endpoints\Indices\Create $endpoint */ |
| 866 | 866 | $endpoint = $endpointBuilder('Indices\Create'); |
| 867 | 867 | $endpoint->setIndex($index) |
| 868 | - ->setBody($body); |
|
| 868 | + ->setBody($body); |
|
| 869 | 869 | $endpoint->setParams($params); |
| 870 | 870 | $response = $endpoint->performRequest(); |
| 871 | 871 | return $response['data']; |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | /** @var \Elasticsearch\Endpoints\Indices\Alias\Delete $endpoint */ |
| 931 | 931 | $endpoint = $endpointBuilder('Indices\Alias\Delete'); |
| 932 | 932 | $endpoint->setIndex($index) |
| 933 | - ->setName($name); |
|
| 933 | + ->setName($name); |
|
| 934 | 934 | $endpoint->setParams($params); |
| 935 | 935 | $response = $endpoint->performRequest(); |
| 936 | 936 | return $response['data']; |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | /** @var \Elasticsearch\Endpoints\Indices\Analyze $endpoint */ |
| 994 | 994 | $endpoint = $endpointBuilder('Indices\Analyze'); |
| 995 | 995 | $endpoint->setIndex($index) |
| 996 | - ->setBody($body); |
|
| 996 | + ->setBody($body); |
|
| 997 | 997 | $endpoint->setParams($params); |
| 998 | 998 | $response = $endpoint->performRequest(); |
| 999 | 999 | return $response['data']; |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | /** @var \Elasticsearch\Endpoints\Indices\Aliases\Update $endpoint */ |
| 1062 | 1062 | $endpoint = $endpointBuilder('Indices\Aliases\Update'); |
| 1063 | 1063 | $endpoint->setIndex($index) |
| 1064 | - ->setBody($body); |
|
| 1064 | + ->setBody($body); |
|
| 1065 | 1065 | $endpoint->setParams($params); |
| 1066 | 1066 | $response = $endpoint->performRequest(); |
| 1067 | 1067 | return $response['data']; |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | /** @var \Elasticsearch\Endpoints\Indices\Aliases\Get $endpoint */ |
| 1091 | 1091 | $endpoint = $endpointBuilder('Indices\Aliases\Get'); |
| 1092 | 1092 | $endpoint->setIndex($index) |
| 1093 | - ->setName($name); |
|
| 1093 | + ->setName($name); |
|
| 1094 | 1094 | $endpoint->setParams($params); |
| 1095 | 1095 | $response = $endpoint->performRequest(); |
| 1096 | 1096 | return $response['data']; |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | /** @var \Elasticsearch\Endpoints\Indices\Alias\Exists $endpoint */ |
| 1124 | 1124 | $endpoint = $endpointBuilder('Indices\Alias\Exists'); |
| 1125 | 1125 | $endpoint->setIndex($index) |
| 1126 | - ->setName($name); |
|
| 1126 | + ->setName($name); |
|
| 1127 | 1127 | $endpoint->setParams($params); |
| 1128 | 1128 | |
| 1129 | 1129 | try { |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | /** @var \Elasticsearch\Endpoints\Indices\Settings\Get $endpoint */ |
| 1193 | 1193 | $endpoint = $endpointBuilder('Indices\Settings\Get'); |
| 1194 | 1194 | $endpoint->setIndex($index) |
| 1195 | - ->setName($name); |
|
| 1195 | + ->setName($name); |
|
| 1196 | 1196 | $endpoint->setParams($params); |
| 1197 | 1197 | $response = $endpoint->performRequest(); |
| 1198 | 1198 | return $response['data']; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @return array |
| 100 | 100 | */ |
| 101 | - public function segments($params = array()) |
|
| 101 | + public function segments($params = array ()) |
|
| 102 | 102 | { |
| 103 | 103 | $index = $this->extractArgument($params, 'index'); |
| 104 | 104 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @return array |
| 187 | 187 | */ |
| 188 | - public function delete($params = array()) |
|
| 188 | + public function delete($params = array ()) |
|
| 189 | 189 | { |
| 190 | 190 | $index = $this->extractArgument($params, 'index'); |
| 191 | 191 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return array |
| 232 | 232 | */ |
| 233 | - public function stats($params = array()) |
|
| 233 | + public function stats($params = array ()) |
|
| 234 | 234 | { |
| 235 | 235 | $metric = $this->extractArgument($params, 'metric'); |
| 236 | 236 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @return array |
| 259 | 259 | */ |
| 260 | - public function putSettings($params = array()) |
|
| 260 | + public function putSettings($params = array ()) |
|
| 261 | 261 | { |
| 262 | 262 | $index = $this->extractArgument($params, 'index'); |
| 263 | 263 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * |
| 290 | 290 | * @return array |
| 291 | 291 | */ |
| 292 | - public function snapshotIndex($params = array()) |
|
| 292 | + public function snapshotIndex($params = array ()) |
|
| 293 | 293 | { |
| 294 | 294 | $index = $this->extractArgument($params, 'index'); |
| 295 | 295 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return array |
| 317 | 317 | */ |
| 318 | - public function getMapping($params = array()) |
|
| 318 | + public function getMapping($params = array ()) |
|
| 319 | 319 | { |
| 320 | 320 | $index = $this->extractArgument($params, 'index'); |
| 321 | 321 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * |
| 347 | 347 | * @return array |
| 348 | 348 | */ |
| 349 | - public function getFieldMapping($params = array()) |
|
| 349 | + public function getFieldMapping($params = array ()) |
|
| 350 | 350 | { |
| 351 | 351 | $index = $this->extractArgument($params, 'index'); |
| 352 | 352 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return array |
| 385 | 385 | */ |
| 386 | - public function flush($params = array()) |
|
| 386 | + public function flush($params = array ()) |
|
| 387 | 387 | { |
| 388 | 388 | $index = $this->extractArgument($params, 'index'); |
| 389 | 389 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * |
| 413 | 413 | * @return array |
| 414 | 414 | */ |
| 415 | - public function refresh($params = array()) |
|
| 415 | + public function refresh($params = array ()) |
|
| 416 | 416 | { |
| 417 | 417 | $index = $this->extractArgument($params, 'index'); |
| 418 | 418 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * @return array |
| 441 | 441 | */ |
| 442 | - public function recovery($params = array()) |
|
| 442 | + public function recovery($params = array ()) |
|
| 443 | 443 | { |
| 444 | 444 | $index = $this->extractArgument($params, 'index'); |
| 445 | 445 | |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | * |
| 510 | 510 | * @return array |
| 511 | 511 | */ |
| 512 | - public function putAlias($params = array()) |
|
| 512 | + public function putAlias($params = array ()) |
|
| 513 | 513 | { |
| 514 | 514 | $index = $this->extractArgument($params, 'index'); |
| 515 | 515 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | * |
| 657 | 657 | * @return array |
| 658 | 658 | */ |
| 659 | - public function validateQuery($params = array()) |
|
| 659 | + public function validateQuery($params = array ()) |
|
| 660 | 660 | { |
| 661 | 661 | $index = $this->extractArgument($params, 'index'); |
| 662 | 662 | |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | * |
| 889 | 889 | * @return array |
| 890 | 890 | */ |
| 891 | - public function optimize($params = array()) |
|
| 891 | + public function optimize($params = array ()) |
|
| 892 | 892 | { |
| 893 | 893 | $index = $this->extractArgument($params, 'index'); |
| 894 | 894 | |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | * |
| 979 | 979 | * @return array |
| 980 | 980 | */ |
| 981 | - public function analyze($params = array()) |
|
| 981 | + public function analyze($params = array ()) |
|
| 982 | 982 | { |
| 983 | 983 | $index = $this->extractArgument($params, 'index'); |
| 984 | 984 | |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | * |
| 1020 | 1020 | * @return array |
| 1021 | 1021 | */ |
| 1022 | - public function clearCache($params = array()) |
|
| 1022 | + public function clearCache($params = array ()) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | $index = $this->extractArgument($params, 'index'); |
| 1025 | 1025 | |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | * |
| 1047 | 1047 | * @return array |
| 1048 | 1048 | */ |
| 1049 | - public function updateAliases($params = array()) |
|
| 1049 | + public function updateAliases($params = array ()) |
|
| 1050 | 1050 | { |
| 1051 | 1051 | $index = $this->extractArgument($params, 'index'); |
| 1052 | 1052 | |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | * |
| 1077 | 1077 | * @return array |
| 1078 | 1078 | */ |
| 1079 | - public function getAliases($params = array()) |
|
| 1079 | + public function getAliases($params = array ()) |
|
| 1080 | 1080 | { |
| 1081 | 1081 | $index = $this->extractArgument($params, 'index'); |
| 1082 | 1082 | |
@@ -1152,7 +1152,7 @@ discard block |
||
| 1152 | 1152 | * |
| 1153 | 1153 | * @return array |
| 1154 | 1154 | */ |
| 1155 | - public function status($params = array()) |
|
| 1155 | + public function status($params = array ()) |
|
| 1156 | 1156 | { |
| 1157 | 1157 | $index = $this->extractArgument($params, 'index'); |
| 1158 | 1158 | |
@@ -1177,7 +1177,7 @@ discard block |
||
| 1177 | 1177 | * |
| 1178 | 1178 | * @return array |
| 1179 | 1179 | */ |
| 1180 | - public function getSettings($params = array()) |
|
| 1180 | + public function getSettings($params = array ()) |
|
| 1181 | 1181 | { |
| 1182 | 1182 | $index = $this->extractArgument($params, 'index'); |
| 1183 | 1183 | |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 19 | 19 | * @link http://elasticsearch.org |
| 20 | 20 | */ |
| 21 | -class IndicesNamespace extends AbstractNamespace |
|
| 22 | -{ |
|
| 21 | +class IndicesNamespace extends AbstractNamespace { |
|
| 23 | 22 | /** |
| 24 | 23 | * $params['index'] = (list) A comma-separated list of indices to check (Required) |
| 25 | 24 | * |
@@ -27,8 +26,7 @@ discard block |
||
| 27 | 26 | * |
| 28 | 27 | * @return bool |
| 29 | 28 | */ |
| 30 | - public function exists($params) |
|
| 31 | - { |
|
| 29 | + public function exists($params) { |
|
| 32 | 30 | $index = $this->extractArgument($params, 'index'); |
| 33 | 31 | |
| 34 | 32 | |
@@ -68,8 +66,7 @@ discard block |
||
| 68 | 66 | * |
| 69 | 67 | * @return bool |
| 70 | 68 | */ |
| 71 | - public function get($params) |
|
| 72 | - { |
|
| 69 | + public function get($params) { |
|
| 73 | 70 | $index = $this->extractArgument($params, 'index'); |
| 74 | 71 | $feature = $this->extractArgument($params, 'feature'); |
| 75 | 72 | |
@@ -98,8 +95,7 @@ discard block |
||
| 98 | 95 | * |
| 99 | 96 | * @return array |
| 100 | 97 | */ |
| 101 | - public function segments($params = array()) |
|
| 102 | - { |
|
| 98 | + public function segments($params = array()) { |
|
| 103 | 99 | $index = $this->extractArgument($params, 'index'); |
| 104 | 100 | |
| 105 | 101 | |
@@ -124,8 +120,7 @@ discard block |
||
| 124 | 120 | * |
| 125 | 121 | * @return array |
| 126 | 122 | */ |
| 127 | - public function deleteTemplate($params) |
|
| 128 | - { |
|
| 123 | + public function deleteTemplate($params) { |
|
| 129 | 124 | $name = $this->extractArgument($params, 'name'); |
| 130 | 125 | |
| 131 | 126 | |
@@ -151,8 +146,7 @@ discard block |
||
| 151 | 146 | * |
| 152 | 147 | * @return array |
| 153 | 148 | */ |
| 154 | - public function deleteWarmer($params) |
|
| 155 | - { |
|
| 149 | + public function deleteWarmer($params) { |
|
| 156 | 150 | $index = $this->extractArgument($params, 'index'); |
| 157 | 151 | |
| 158 | 152 | |
@@ -185,8 +179,7 @@ discard block |
||
| 185 | 179 | * |
| 186 | 180 | * @return array |
| 187 | 181 | */ |
| 188 | - public function delete($params = array()) |
|
| 189 | - { |
|
| 182 | + public function delete($params = array()) { |
|
| 190 | 183 | $index = $this->extractArgument($params, 'index'); |
| 191 | 184 | |
| 192 | 185 | |
@@ -230,8 +223,7 @@ discard block |
||
| 230 | 223 | * |
| 231 | 224 | * @return array |
| 232 | 225 | */ |
| 233 | - public function stats($params = array()) |
|
| 234 | - { |
|
| 226 | + public function stats($params = array()) { |
|
| 235 | 227 | $metric = $this->extractArgument($params, 'metric'); |
| 236 | 228 | |
| 237 | 229 | $index = $this->extractArgument($params, 'index'); |
@@ -257,8 +249,7 @@ discard block |
||
| 257 | 249 | * |
| 258 | 250 | * @return array |
| 259 | 251 | */ |
| 260 | - public function putSettings($params = array()) |
|
| 261 | - { |
|
| 252 | + public function putSettings($params = array()) { |
|
| 262 | 253 | $index = $this->extractArgument($params, 'index'); |
| 263 | 254 | |
| 264 | 255 | |
@@ -289,8 +280,7 @@ discard block |
||
| 289 | 280 | * |
| 290 | 281 | * @return array |
| 291 | 282 | */ |
| 292 | - public function snapshotIndex($params = array()) |
|
| 293 | - { |
|
| 283 | + public function snapshotIndex($params = array()) { |
|
| 294 | 284 | $index = $this->extractArgument($params, 'index'); |
| 295 | 285 | |
| 296 | 286 | |
@@ -315,8 +305,7 @@ discard block |
||
| 315 | 305 | * |
| 316 | 306 | * @return array |
| 317 | 307 | */ |
| 318 | - public function getMapping($params = array()) |
|
| 319 | - { |
|
| 308 | + public function getMapping($params = array()) { |
|
| 320 | 309 | $index = $this->extractArgument($params, 'index'); |
| 321 | 310 | |
| 322 | 311 | |
@@ -346,8 +335,7 @@ discard block |
||
| 346 | 335 | * |
| 347 | 336 | * @return array |
| 348 | 337 | */ |
| 349 | - public function getFieldMapping($params = array()) |
|
| 350 | - { |
|
| 338 | + public function getFieldMapping($params = array()) { |
|
| 351 | 339 | $index = $this->extractArgument($params, 'index'); |
| 352 | 340 | |
| 353 | 341 | $type = $this->extractArgument($params, 'type'); |
@@ -383,8 +371,7 @@ discard block |
||
| 383 | 371 | * |
| 384 | 372 | * @return array |
| 385 | 373 | */ |
| 386 | - public function flush($params = array()) |
|
| 387 | - { |
|
| 374 | + public function flush($params = array()) { |
|
| 388 | 375 | $index = $this->extractArgument($params, 'index'); |
| 389 | 376 | |
| 390 | 377 | |
@@ -412,8 +399,7 @@ discard block |
||
| 412 | 399 | * |
| 413 | 400 | * @return array |
| 414 | 401 | */ |
| 415 | - public function refresh($params = array()) |
|
| 416 | - { |
|
| 402 | + public function refresh($params = array()) { |
|
| 417 | 403 | $index = $this->extractArgument($params, 'index'); |
| 418 | 404 | |
| 419 | 405 | |
@@ -439,8 +425,7 @@ discard block |
||
| 439 | 425 | * |
| 440 | 426 | * @return array |
| 441 | 427 | */ |
| 442 | - public function recovery($params = array()) |
|
| 443 | - { |
|
| 428 | + public function recovery($params = array()) { |
|
| 444 | 429 | $index = $this->extractArgument($params, 'index'); |
| 445 | 430 | |
| 446 | 431 | /** @var callback $endpointBuilder */ |
@@ -466,8 +451,7 @@ discard block |
||
| 466 | 451 | * |
| 467 | 452 | * @return array |
| 468 | 453 | */ |
| 469 | - public function existsType($params) |
|
| 470 | - { |
|
| 454 | + public function existsType($params) { |
|
| 471 | 455 | $index = $this->extractArgument($params, 'index'); |
| 472 | 456 | |
| 473 | 457 | |
@@ -509,8 +493,7 @@ discard block |
||
| 509 | 493 | * |
| 510 | 494 | * @return array |
| 511 | 495 | */ |
| 512 | - public function putAlias($params = array()) |
|
| 513 | - { |
|
| 496 | + public function putAlias($params = array()) { |
|
| 514 | 497 | $index = $this->extractArgument($params, 'index'); |
| 515 | 498 | |
| 516 | 499 | |
@@ -544,8 +527,7 @@ discard block |
||
| 544 | 527 | * |
| 545 | 528 | * @return array |
| 546 | 529 | */ |
| 547 | - public function getWarmer($params) |
|
| 548 | - { |
|
| 530 | + public function getWarmer($params) { |
|
| 549 | 531 | $index = $this->extractArgument($params, 'index'); |
| 550 | 532 | |
| 551 | 533 | |
@@ -580,8 +562,7 @@ discard block |
||
| 580 | 562 | * |
| 581 | 563 | * @return array |
| 582 | 564 | */ |
| 583 | - public function putWarmer($params) |
|
| 584 | - { |
|
| 565 | + public function putWarmer($params) { |
|
| 585 | 566 | $index = $this->extractArgument($params, 'index'); |
| 586 | 567 | |
| 587 | 568 | |
@@ -621,8 +602,7 @@ discard block |
||
| 621 | 602 | * |
| 622 | 603 | * @return array |
| 623 | 604 | */ |
| 624 | - public function putTemplate($params) |
|
| 625 | - { |
|
| 605 | + public function putTemplate($params) { |
|
| 626 | 606 | $name = $this->extractArgument($params, 'name'); |
| 627 | 607 | |
| 628 | 608 | |
@@ -656,8 +636,7 @@ discard block |
||
| 656 | 636 | * |
| 657 | 637 | * @return array |
| 658 | 638 | */ |
| 659 | - public function validateQuery($params = array()) |
|
| 660 | - { |
|
| 639 | + public function validateQuery($params = array()) { |
|
| 661 | 640 | $index = $this->extractArgument($params, 'index'); |
| 662 | 641 | |
| 663 | 642 | |
@@ -692,8 +671,7 @@ discard block |
||
| 692 | 671 | * |
| 693 | 672 | * @return array |
| 694 | 673 | */ |
| 695 | - public function getAlias($params) |
|
| 696 | - { |
|
| 674 | + public function getAlias($params) { |
|
| 697 | 675 | $index = $this->extractArgument($params, 'index'); |
| 698 | 676 | |
| 699 | 677 | |
@@ -725,8 +703,7 @@ discard block |
||
| 725 | 703 | * |
| 726 | 704 | * @return array |
| 727 | 705 | */ |
| 728 | - public function putMapping($params) |
|
| 729 | - { |
|
| 706 | + public function putMapping($params) { |
|
| 730 | 707 | $index = $this->extractArgument($params, 'index'); |
| 731 | 708 | |
| 732 | 709 | |
@@ -758,8 +735,7 @@ discard block |
||
| 758 | 735 | * |
| 759 | 736 | * @return array |
| 760 | 737 | */ |
| 761 | - public function deleteMapping($params) |
|
| 762 | - { |
|
| 738 | + public function deleteMapping($params) { |
|
| 763 | 739 | $index = $this->extractArgument($params, 'index'); |
| 764 | 740 | |
| 765 | 741 | |
@@ -787,8 +763,7 @@ discard block |
||
| 787 | 763 | * |
| 788 | 764 | * @return array |
| 789 | 765 | */ |
| 790 | - public function getTemplate($params) |
|
| 791 | - { |
|
| 766 | + public function getTemplate($params) { |
|
| 792 | 767 | $name = $this->extractArgument($params, 'name'); |
| 793 | 768 | |
| 794 | 769 | |
@@ -812,8 +787,7 @@ discard block |
||
| 812 | 787 | * |
| 813 | 788 | * @return array |
| 814 | 789 | */ |
| 815 | - public function existsTemplate($params) |
|
| 816 | - { |
|
| 790 | + public function existsTemplate($params) { |
|
| 817 | 791 | $name = $this->extractArgument($params, 'name'); |
| 818 | 792 | |
| 819 | 793 | |
@@ -850,8 +824,7 @@ discard block |
||
| 850 | 824 | * |
| 851 | 825 | * @return array |
| 852 | 826 | */ |
| 853 | - public function create($params) |
|
| 854 | - { |
|
| 827 | + public function create($params) { |
|
| 855 | 828 | $index = $this->extractArgument($params, 'index'); |
| 856 | 829 | |
| 857 | 830 | |
@@ -888,8 +861,7 @@ discard block |
||
| 888 | 861 | * |
| 889 | 862 | * @return array |
| 890 | 863 | */ |
| 891 | - public function optimize($params = array()) |
|
| 892 | - { |
|
| 864 | + public function optimize($params = array()) { |
|
| 893 | 865 | $index = $this->extractArgument($params, 'index'); |
| 894 | 866 | |
| 895 | 867 | |
@@ -915,8 +887,7 @@ discard block |
||
| 915 | 887 | * |
| 916 | 888 | * @return array |
| 917 | 889 | */ |
| 918 | - public function deleteAlias($params) |
|
| 919 | - { |
|
| 890 | + public function deleteAlias($params) { |
|
| 920 | 891 | $index = $this->extractArgument($params, 'index'); |
| 921 | 892 | |
| 922 | 893 | |
@@ -945,8 +916,7 @@ discard block |
||
| 945 | 916 | * |
| 946 | 917 | * @return array |
| 947 | 918 | */ |
| 948 | - public function open($params) |
|
| 949 | - { |
|
| 919 | + public function open($params) { |
|
| 950 | 920 | $index = $this->extractArgument($params, 'index'); |
| 951 | 921 | |
| 952 | 922 | |
@@ -978,8 +948,7 @@ discard block |
||
| 978 | 948 | * |
| 979 | 949 | * @return array |
| 980 | 950 | */ |
| 981 | - public function analyze($params = array()) |
|
| 982 | - { |
|
| 951 | + public function analyze($params = array()) { |
|
| 983 | 952 | $index = $this->extractArgument($params, 'index'); |
| 984 | 953 | |
| 985 | 954 | |
@@ -1019,8 +988,7 @@ discard block |
||
| 1019 | 988 | * |
| 1020 | 989 | * @return array |
| 1021 | 990 | */ |
| 1022 | - public function clearCache($params = array()) |
|
| 1023 | - { |
|
| 991 | + public function clearCache($params = array()) { |
|
| 1024 | 992 | $index = $this->extractArgument($params, 'index'); |
| 1025 | 993 | |
| 1026 | 994 | |
@@ -1046,8 +1014,7 @@ discard block |
||
| 1046 | 1014 | * |
| 1047 | 1015 | * @return array |
| 1048 | 1016 | */ |
| 1049 | - public function updateAliases($params = array()) |
|
| 1050 | - { |
|
| 1017 | + public function updateAliases($params = array()) { |
|
| 1051 | 1018 | $index = $this->extractArgument($params, 'index'); |
| 1052 | 1019 | |
| 1053 | 1020 | |
@@ -1076,8 +1043,7 @@ discard block |
||
| 1076 | 1043 | * |
| 1077 | 1044 | * @return array |
| 1078 | 1045 | */ |
| 1079 | - public function getAliases($params = array()) |
|
| 1080 | - { |
|
| 1046 | + public function getAliases($params = array()) { |
|
| 1081 | 1047 | $index = $this->extractArgument($params, 'index'); |
| 1082 | 1048 | |
| 1083 | 1049 | |
@@ -1108,8 +1074,7 @@ discard block |
||
| 1108 | 1074 | * |
| 1109 | 1075 | * @return array |
| 1110 | 1076 | */ |
| 1111 | - public function existsAlias($params) |
|
| 1112 | - { |
|
| 1077 | + public function existsAlias($params) { |
|
| 1113 | 1078 | $index = $this->extractArgument($params, 'index'); |
| 1114 | 1079 | |
| 1115 | 1080 | |
@@ -1152,8 +1117,7 @@ discard block |
||
| 1152 | 1117 | * |
| 1153 | 1118 | * @return array |
| 1154 | 1119 | */ |
| 1155 | - public function status($params = array()) |
|
| 1156 | - { |
|
| 1120 | + public function status($params = array()) { |
|
| 1157 | 1121 | $index = $this->extractArgument($params, 'index'); |
| 1158 | 1122 | |
| 1159 | 1123 | |
@@ -1177,8 +1141,7 @@ discard block |
||
| 1177 | 1141 | * |
| 1178 | 1142 | * @return array |
| 1179 | 1143 | */ |
| 1180 | - public function getSettings($params = array()) |
|
| 1181 | - { |
|
| 1144 | + public function getSettings($params = array()) { |
|
| 1182 | 1145 | $index = $this->extractArgument($params, 'index'); |
| 1183 | 1146 | |
| 1184 | 1147 | |
@@ -1207,8 +1170,7 @@ discard block |
||
| 1207 | 1170 | * |
| 1208 | 1171 | * @return array |
| 1209 | 1172 | */ |
| 1210 | - public function close($params) |
|
| 1211 | - { |
|
| 1173 | + public function close($params) { |
|
| 1212 | 1174 | $index = $this->extractArgument($params, 'index'); |
| 1213 | 1175 | |
| 1214 | 1176 | |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | try { |
| 45 | 45 | $response = $endpoint->performRequest(); |
| 46 | 46 | } catch (Missing404Exception $exception) { |
| 47 | - return false; |
|
| 47 | + return FALSE; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | if ($response['status'] === 200) { |
| 52 | - return true; |
|
| 52 | + return TRUE; |
|
| 53 | 53 | } else { |
| 54 | - return false; |
|
| 54 | + return FALSE; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -487,14 +487,14 @@ discard block |
||
| 487 | 487 | try { |
| 488 | 488 | $response = $endpoint->performRequest(); |
| 489 | 489 | } catch (Missing404Exception $exception) { |
| 490 | - return false; |
|
| 490 | + return FALSE; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | |
| 494 | 494 | if ($response['status'] === 200) { |
| 495 | - return true; |
|
| 495 | + return TRUE; |
|
| 496 | 496 | } else { |
| 497 | - return false; |
|
| 497 | + return FALSE; |
|
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | |
@@ -829,14 +829,14 @@ discard block |
||
| 829 | 829 | try { |
| 830 | 830 | $response = $endpoint->performRequest(); |
| 831 | 831 | } catch (Missing404Exception $exception) { |
| 832 | - return false; |
|
| 832 | + return FALSE; |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | if ($response['status'] === 200) { |
| 837 | - return true; |
|
| 837 | + return TRUE; |
|
| 838 | 838 | } else { |
| 839 | - return false; |
|
| 839 | + return FALSE; |
|
| 840 | 840 | } |
| 841 | 841 | } |
| 842 | 842 | |
@@ -1129,14 +1129,14 @@ discard block |
||
| 1129 | 1129 | try { |
| 1130 | 1130 | $response = $endpoint->performRequest(); |
| 1131 | 1131 | } catch (Missing404Exception $exception) { |
| 1132 | - return false; |
|
| 1132 | + return FALSE; |
|
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | 1136 | if ($response['status'] === 200) { |
| 1137 | - return true; |
|
| 1137 | + return TRUE; |
|
| 1138 | 1138 | } else { |
| 1139 | - return false; |
|
| 1139 | + return FALSE; |
|
| 1140 | 1140 | } |
| 1141 | 1141 | } |
| 1142 | 1142 | |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | /** @var \Elasticsearch\Endpoints\Cluster\Nodes\Stats $endpoint */ |
| 55 | 55 | $endpoint = $endpointBuilder('Cluster\Nodes\Stats'); |
| 56 | 56 | $endpoint->setNodeID($nodeID) |
| 57 | - ->setMetric($metric) |
|
| 58 | - ->setIndexMetric($index_metric) |
|
| 59 | - ->setParams($params); |
|
| 57 | + ->setMetric($metric) |
|
| 58 | + ->setIndexMetric($index_metric) |
|
| 59 | + ->setParams($params); |
|
| 60 | 60 | $response = $endpoint->performRequest(); |
| 61 | 61 | return $response['data']; |
| 62 | 62 | } |
@@ -66,7 +66,6 @@ discard block |
||
| 66 | 66 | * ['metric'] = (list) A comma-separated list of metrics you wish returned. Leave empty to return all. |
| 67 | 67 | * ['flat_settings'] = (boolean) Return settings in flat format (default: false) |
| 68 | 68 | * ['human'] = (boolean) Whether to return time and byte values in human-readable format. |
| 69 | - |
|
| 70 | 69 | * |
| 71 | 70 | * @param $params array Associative array of parameters |
| 72 | 71 | * |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return array |
| 41 | 41 | */ |
| 42 | - public function stats($params = array()) |
|
| 42 | + public function stats($params = array ()) |
|
| 43 | 43 | { |
| 44 | 44 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 45 | 45 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return array |
| 74 | 74 | */ |
| 75 | - public function info($params = array()) |
|
| 75 | + public function info($params = array ()) |
|
| 76 | 76 | { |
| 77 | 77 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 78 | 78 | $metric = $this->extractArgument($params, 'metric'); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return array |
| 101 | 101 | */ |
| 102 | - public function hotThreads($params = array()) |
|
| 102 | + public function hotThreads($params = array ()) |
|
| 103 | 103 | { |
| 104 | 104 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 105 | 105 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return array |
| 126 | 126 | */ |
| 127 | - public function shutdown($params = array()) |
|
| 127 | + public function shutdown($params = array ()) |
|
| 128 | 128 | { |
| 129 | 129 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 130 | 130 | |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 17 | 17 | * @link http://elasticsearch.org |
| 18 | 18 | */ |
| 19 | -class NodesNamespace extends AbstractNamespace |
|
| 20 | -{ |
|
| 19 | +class NodesNamespace extends AbstractNamespace { |
|
| 21 | 20 | /** |
| 22 | 21 | * $params['fields'] = (list) A comma-separated list of fields for `fielddata` metric (supports wildcards) |
| 23 | 22 | * ['metric_family'] = (enum) Limit the information returned to a certain metric family |
@@ -39,8 +38,7 @@ discard block |
||
| 39 | 38 | * |
| 40 | 39 | * @return array |
| 41 | 40 | */ |
| 42 | - public function stats($params = array()) |
|
| 43 | - { |
|
| 41 | + public function stats($params = array()) { |
|
| 44 | 42 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 45 | 43 | |
| 46 | 44 | $metric = $this->extractArgument($params, 'metric'); |
@@ -72,8 +70,7 @@ discard block |
||
| 72 | 70 | * |
| 73 | 71 | * @return array |
| 74 | 72 | */ |
| 75 | - public function info($params = array()) |
|
| 76 | - { |
|
| 73 | + public function info($params = array()) { |
|
| 77 | 74 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 78 | 75 | $metric = $this->extractArgument($params, 'metric'); |
| 79 | 76 | |
@@ -99,8 +96,7 @@ discard block |
||
| 99 | 96 | * |
| 100 | 97 | * @return array |
| 101 | 98 | */ |
| 102 | - public function hotThreads($params = array()) |
|
| 103 | - { |
|
| 99 | + public function hotThreads($params = array()) { |
|
| 104 | 100 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 105 | 101 | |
| 106 | 102 | |
@@ -124,8 +120,7 @@ discard block |
||
| 124 | 120 | * |
| 125 | 121 | * @return array |
| 126 | 122 | */ |
| 127 | - public function shutdown($params = array()) |
|
| 128 | - { |
|
| 123 | + public function shutdown($params = array()) { |
|
| 129 | 124 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 130 | 125 | |
| 131 | 126 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | /** @var \Elasticsearch\Endpoints\Cluster\State $endpoint */ |
| 105 | 105 | $endpoint = $endpointBuilder('Cluster\State'); |
| 106 | 106 | $endpoint->setParams($params) |
| 107 | - ->setIndex($index) |
|
| 108 | - ->setMetric($metric); |
|
| 107 | + ->setIndex($index) |
|
| 108 | + ->setMetric($metric); |
|
| 109 | 109 | $response = $endpoint->performRequest(); |
| 110 | 110 | return $response['data']; |
| 111 | 111 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | /** @var \Elasticsearch\Endpoints\Cluster\Stats $endpoint */ |
| 129 | 129 | $endpoint = $endpointBuilder('Cluster\Stats'); |
| 130 | 130 | $endpoint->setNodeID($nodeID) |
| 131 | - ->setParams($params); |
|
| 131 | + ->setParams($params); |
|
| 132 | 132 | $response = $endpoint->performRequest(); |
| 133 | 133 | return $response['data']; |
| 134 | 134 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @return array |
| 36 | 36 | */ |
| 37 | - public function health($params = array()) |
|
| 37 | + public function health($params = array ()) |
|
| 38 | 38 | { |
| 39 | 39 | $index = $this->extractArgument($params, 'index'); |
| 40 | 40 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return array |
| 64 | 64 | */ |
| 65 | - public function reroute($params = array()) |
|
| 65 | + public function reroute($params = array ()) |
|
| 66 | 66 | { |
| 67 | 67 | $body = $this->extractArgument($params, 'body'); |
| 68 | 68 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return array |
| 95 | 95 | */ |
| 96 | - public function state($params = array()) |
|
| 96 | + public function state($params = array ()) |
|
| 97 | 97 | { |
| 98 | 98 | $index = $this->extractArgument($params, 'index'); |
| 99 | 99 | $metric = $this->extractArgument($params, 'metric'); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @return array |
| 120 | 120 | */ |
| 121 | - public function stats($params = array()) |
|
| 121 | + public function stats($params = array ()) |
|
| 122 | 122 | { |
| 123 | 123 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 124 | 124 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @return array |
| 143 | 143 | */ |
| 144 | - public function putSettings($params = array()) |
|
| 144 | + public function putSettings($params = array ()) |
|
| 145 | 145 | { |
| 146 | 146 | $body = $this->extractArgument($params, 'body'); |
| 147 | 147 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @return array |
| 166 | 166 | */ |
| 167 | - public function getSettings($params = array()) |
|
| 167 | + public function getSettings($params = array ()) |
|
| 168 | 168 | { |
| 169 | 169 | /** @var callback $endpointBuilder */ |
| 170 | 170 | $endpointBuilder = $this->dicEndpoints; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @return array |
| 187 | 187 | */ |
| 188 | - public function pendingTasks($params = array()) |
|
| 188 | + public function pendingTasks($params = array ()) |
|
| 189 | 189 | { |
| 190 | 190 | |
| 191 | 191 | /** @var callback $endpointBuilder */ |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 17 | 17 | * @link http://elasticsearch.org |
| 18 | 18 | */ |
| 19 | -class ClusterNamespace extends AbstractNamespace |
|
| 20 | -{ |
|
| 19 | +class ClusterNamespace extends AbstractNamespace { |
|
| 21 | 20 | |
| 22 | 21 | /** |
| 23 | 22 | * $params['index'] = (string) Limit the information returned to a specific index |
@@ -34,8 +33,7 @@ discard block |
||
| 34 | 33 | * |
| 35 | 34 | * @return array |
| 36 | 35 | */ |
| 37 | - public function health($params = array()) |
|
| 38 | - { |
|
| 36 | + public function health($params = array()) { |
|
| 39 | 37 | $index = $this->extractArgument($params, 'index'); |
| 40 | 38 | |
| 41 | 39 | |
@@ -62,8 +60,7 @@ discard block |
||
| 62 | 60 | * |
| 63 | 61 | * @return array |
| 64 | 62 | */ |
| 65 | - public function reroute($params = array()) |
|
| 66 | - { |
|
| 63 | + public function reroute($params = array()) { |
|
| 67 | 64 | $body = $this->extractArgument($params, 'body'); |
| 68 | 65 | |
| 69 | 66 | |
@@ -93,8 +90,7 @@ discard block |
||
| 93 | 90 | * |
| 94 | 91 | * @return array |
| 95 | 92 | */ |
| 96 | - public function state($params = array()) |
|
| 97 | - { |
|
| 93 | + public function state($params = array()) { |
|
| 98 | 94 | $index = $this->extractArgument($params, 'index'); |
| 99 | 95 | $metric = $this->extractArgument($params, 'metric'); |
| 100 | 96 | |
@@ -118,8 +114,7 @@ discard block |
||
| 118 | 114 | * |
| 119 | 115 | * @return array |
| 120 | 116 | */ |
| 121 | - public function stats($params = array()) |
|
| 122 | - { |
|
| 117 | + public function stats($params = array()) { |
|
| 123 | 118 | $nodeID = $this->extractArgument($params, 'node_id'); |
| 124 | 119 | |
| 125 | 120 | /** @var callback $endpointBuilder */ |
@@ -141,8 +136,7 @@ discard block |
||
| 141 | 136 | * |
| 142 | 137 | * @return array |
| 143 | 138 | */ |
| 144 | - public function putSettings($params = array()) |
|
| 145 | - { |
|
| 139 | + public function putSettings($params = array()) { |
|
| 146 | 140 | $body = $this->extractArgument($params, 'body'); |
| 147 | 141 | |
| 148 | 142 | |
@@ -164,8 +158,7 @@ discard block |
||
| 164 | 158 | * |
| 165 | 159 | * @return array |
| 166 | 160 | */ |
| 167 | - public function getSettings($params = array()) |
|
| 168 | - { |
|
| 161 | + public function getSettings($params = array()) { |
|
| 169 | 162 | /** @var callback $endpointBuilder */ |
| 170 | 163 | $endpointBuilder = $this->dicEndpoints; |
| 171 | 164 | |
@@ -185,8 +178,7 @@ discard block |
||
| 185 | 178 | * |
| 186 | 179 | * @return array |
| 187 | 180 | */ |
| 188 | - public function pendingTasks($params = array()) |
|
| 189 | - { |
|
| 181 | + public function pendingTasks($params = array()) { |
|
| 190 | 182 | |
| 191 | 183 | /** @var callback $endpointBuilder */ |
| 192 | 184 | $endpointBuilder = $this->dicEndpoints; |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | /** @var \Elasticsearch\Endpoints\Get $endpoint */ |
| 172 | 172 | $endpoint = $endpointBuilder('Get'); |
| 173 | 173 | $endpoint->setID($id) |
| 174 | - ->setIndex($index) |
|
| 175 | - ->setType($type); |
|
| 174 | + ->setIndex($index) |
|
| 175 | + ->setType($type); |
|
| 176 | 176 | $endpoint->setParams($params); |
| 177 | 177 | $response = $endpoint->performRequest(); |
| 178 | 178 | return $response['data']; |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | /** @var \Elasticsearch\Endpoints\Get $endpoint */ |
| 213 | 213 | $endpoint = $endpointBuilder('Get'); |
| 214 | 214 | $endpoint->setID($id) |
| 215 | - ->setIndex($index) |
|
| 216 | - ->setType($type) |
|
| 217 | - ->returnOnlySource(); |
|
| 215 | + ->setIndex($index) |
|
| 216 | + ->setType($type) |
|
| 217 | + ->returnOnlySource(); |
|
| 218 | 218 | $endpoint->setParams($params); |
| 219 | 219 | $response = $endpoint->performRequest(); |
| 220 | 220 | return $response['data']; |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | /** @var \Elasticsearch\Endpoints\Delete $endpoint */ |
| 256 | 256 | $endpoint = $endpointBuilder('Delete'); |
| 257 | 257 | $endpoint->setID($id) |
| 258 | - ->setIndex($index) |
|
| 259 | - ->setType($type); |
|
| 258 | + ->setIndex($index) |
|
| 259 | + ->setType($type); |
|
| 260 | 260 | $endpoint->setParams($params); |
| 261 | 261 | $response = $endpoint->performRequest(); |
| 262 | 262 | return $response['data']; |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | /** @var \Elasticsearch\Endpoints\Count $endpoint */ |
| 335 | 335 | $endpoint = $endpointBuilder('Count'); |
| 336 | 336 | $endpoint->setIndex($index) |
| 337 | - ->setType($type) |
|
| 338 | - ->setBody($body); |
|
| 337 | + ->setType($type) |
|
| 338 | + ->setBody($body); |
|
| 339 | 339 | $endpoint->setParams($params); |
| 340 | 340 | $response = $endpoint->performRequest(); |
| 341 | 341 | return $response['data']; |
@@ -373,9 +373,9 @@ discard block |
||
| 373 | 373 | /** @var \Elasticsearch\Endpoints\CountPercolate $endpoint */ |
| 374 | 374 | $endpoint = $endpointBuilder('CountPercolate'); |
| 375 | 375 | $endpoint->setIndex($index) |
| 376 | - ->setType($type) |
|
| 377 | - ->setID($id) |
|
| 378 | - ->setBody($body); |
|
| 376 | + ->setType($type) |
|
| 377 | + ->setID($id) |
|
| 378 | + ->setBody($body); |
|
| 379 | 379 | $endpoint->setParams($params); |
| 380 | 380 | $response = $endpoint->performRequest(); |
| 381 | 381 | return $response['data']; |
@@ -407,9 +407,9 @@ discard block |
||
| 407 | 407 | /** @var \Elasticsearch\Endpoints\Percolate $endpoint */ |
| 408 | 408 | $endpoint = $endpointBuilder('Percolate'); |
| 409 | 409 | $endpoint->setIndex($index) |
| 410 | - ->setType($type) |
|
| 411 | - ->setID($id) |
|
| 412 | - ->setBody($body); |
|
| 410 | + ->setType($type) |
|
| 411 | + ->setID($id) |
|
| 412 | + ->setBody($body); |
|
| 413 | 413 | $endpoint->setParams($params); |
| 414 | 414 | $response = $endpoint->performRequest(); |
| 415 | 415 | return $response['data']; |
@@ -440,8 +440,8 @@ discard block |
||
| 440 | 440 | /** @var \Elasticsearch\Endpoints\MPercolate $endpoint */ |
| 441 | 441 | $endpoint = $endpointBuilder('MPercolate'); |
| 442 | 442 | $endpoint->setIndex($index) |
| 443 | - ->setType($type) |
|
| 444 | - ->setBody($body); |
|
| 443 | + ->setType($type) |
|
| 444 | + ->setBody($body); |
|
| 445 | 445 | $endpoint->setParams($params); |
| 446 | 446 | $response = $endpoint->performRequest(); |
| 447 | 447 | return $response['data']; |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | /** @var \Elasticsearch\Endpoints\TermVectors $endpoint */ |
| 480 | 480 | $endpoint = $endpointBuilder('TermVectors'); |
| 481 | 481 | $endpoint->setIndex($index) |
| 482 | - ->setType($type) |
|
| 483 | - ->setID($id) |
|
| 484 | - ->setBody($body); |
|
| 482 | + ->setType($type) |
|
| 483 | + ->setID($id) |
|
| 484 | + ->setBody($body); |
|
| 485 | 485 | $endpoint->setParams($params); |
| 486 | 486 | $response = $endpoint->performRequest(); |
| 487 | 487 | return $response['data']; |
@@ -519,8 +519,8 @@ discard block |
||
| 519 | 519 | /** @var \Elasticsearch\Endpoints\MTermVectors $endpoint */ |
| 520 | 520 | $endpoint = $endpointBuilder('MTermVectors'); |
| 521 | 521 | $endpoint->setIndex($index) |
| 522 | - ->setType($type) |
|
| 523 | - ->setBody($body); |
|
| 522 | + ->setType($type) |
|
| 523 | + ->setBody($body); |
|
| 524 | 524 | $endpoint->setParams($params); |
| 525 | 525 | $response = $endpoint->performRequest(); |
| 526 | 526 | return $response['data']; |
@@ -559,8 +559,8 @@ discard block |
||
| 559 | 559 | /** @var \Elasticsearch\Endpoints\Exists $endpoint */ |
| 560 | 560 | $endpoint = $endpointBuilder('Exists'); |
| 561 | 561 | $endpoint->setID($id) |
| 562 | - ->setIndex($index) |
|
| 563 | - ->setType($type); |
|
| 562 | + ->setIndex($index) |
|
| 563 | + ->setType($type); |
|
| 564 | 564 | $endpoint->setParams($params); |
| 565 | 565 | |
| 566 | 566 | try { |
@@ -630,9 +630,9 @@ discard block |
||
| 630 | 630 | /** @var \Elasticsearch\Endpoints\Mlt $endpoint */ |
| 631 | 631 | $endpoint = $endpointBuilder('Mlt'); |
| 632 | 632 | $endpoint->setID($id) |
| 633 | - ->setIndex($index) |
|
| 634 | - ->setType($type) |
|
| 635 | - ->setBody($body); |
|
| 633 | + ->setIndex($index) |
|
| 634 | + ->setType($type) |
|
| 635 | + ->setBody($body); |
|
| 636 | 636 | $endpoint->setParams($params); |
| 637 | 637 | $response = $endpoint->performRequest(); |
| 638 | 638 | return $response['data']; |
@@ -675,8 +675,8 @@ discard block |
||
| 675 | 675 | /** @var \Elasticsearch\Endpoints\Mget $endpoint */ |
| 676 | 676 | $endpoint = $endpointBuilder('Mget'); |
| 677 | 677 | $endpoint->setIndex($index) |
| 678 | - ->setType($type) |
|
| 679 | - ->setBody($body); |
|
| 678 | + ->setType($type) |
|
| 679 | + ->setBody($body); |
|
| 680 | 680 | $endpoint->setParams($params); |
| 681 | 681 | $response = $endpoint->performRequest(); |
| 682 | 682 | return $response['data']; |
@@ -711,8 +711,8 @@ discard block |
||
| 711 | 711 | /** @var \Elasticsearch\Endpoints\Msearch $endpoint */ |
| 712 | 712 | $endpoint = $endpointBuilder('Msearch'); |
| 713 | 713 | $endpoint->setIndex($index) |
| 714 | - ->setType($type) |
|
| 715 | - ->setBody($body); |
|
| 714 | + ->setType($type) |
|
| 715 | + ->setBody($body); |
|
| 716 | 716 | $endpoint->setParams($params); |
| 717 | 717 | $response = $endpoint->performRequest(); |
| 718 | 718 | return $response['data']; |
@@ -761,10 +761,10 @@ discard block |
||
| 761 | 761 | /** @var \Elasticsearch\Endpoints\Index $endpoint */ |
| 762 | 762 | $endpoint = $endpointBuilder('Index'); |
| 763 | 763 | $endpoint->setID($id) |
| 764 | - ->setIndex($index) |
|
| 765 | - ->setType($type) |
|
| 766 | - ->setBody($body) |
|
| 767 | - ->createIfAbsent(); |
|
| 764 | + ->setIndex($index) |
|
| 765 | + ->setType($type) |
|
| 766 | + ->setBody($body) |
|
| 767 | + ->createIfAbsent(); |
|
| 768 | 768 | $endpoint->setParams($params); |
| 769 | 769 | $response = $endpoint->performRequest(); |
| 770 | 770 | return $response['data']; |
@@ -801,8 +801,8 @@ discard block |
||
| 801 | 801 | /** @var \Elasticsearch\Endpoints\Bulk $endpoint */ |
| 802 | 802 | $endpoint = $endpointBuilder('Bulk'); |
| 803 | 803 | $endpoint->setIndex($index) |
| 804 | - ->setType($type) |
|
| 805 | - ->setBody($body); |
|
| 804 | + ->setType($type) |
|
| 805 | + ->setBody($body); |
|
| 806 | 806 | $endpoint->setParams($params); |
| 807 | 807 | $response = $endpoint->performRequest(); |
| 808 | 808 | return $response['data']; |
@@ -852,9 +852,9 @@ discard block |
||
| 852 | 852 | /** @var \Elasticsearch\Endpoints\Index $endpoint */ |
| 853 | 853 | $endpoint = $endpointBuilder('Index'); |
| 854 | 854 | $endpoint->setID($id) |
| 855 | - ->setIndex($index) |
|
| 856 | - ->setType($type) |
|
| 857 | - ->setBody($body); |
|
| 855 | + ->setIndex($index) |
|
| 856 | + ->setType($type) |
|
| 857 | + ->setBody($body); |
|
| 858 | 858 | $endpoint->setParams($params); |
| 859 | 859 | $response = $endpoint->performRequest(); |
| 860 | 860 | return $response['data']; |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | /** @var \Elasticsearch\Endpoints\Suggest $endpoint */ |
| 889 | 889 | $endpoint = $endpointBuilder('Suggest'); |
| 890 | 890 | $endpoint->setIndex($index) |
| 891 | - ->setBody($body); |
|
| 891 | + ->setBody($body); |
|
| 892 | 892 | $endpoint->setParams($params); |
| 893 | 893 | $response = $endpoint->performRequest(); |
| 894 | 894 | return $response['data']; |
@@ -941,9 +941,9 @@ discard block |
||
| 941 | 941 | /** @var \Elasticsearch\Endpoints\Explain $endpoint */ |
| 942 | 942 | $endpoint = $endpointBuilder('Explain'); |
| 943 | 943 | $endpoint->setID($id) |
| 944 | - ->setIndex($index) |
|
| 945 | - ->setType($type) |
|
| 946 | - ->setBody($body); |
|
| 944 | + ->setIndex($index) |
|
| 945 | + ->setType($type) |
|
| 946 | + ->setBody($body); |
|
| 947 | 947 | $endpoint->setParams($params); |
| 948 | 948 | $response = $endpoint->performRequest(); |
| 949 | 949 | return $response['data']; |
@@ -1006,8 +1006,8 @@ discard block |
||
| 1006 | 1006 | /** @var \Elasticsearch\Endpoints\Search $endpoint */ |
| 1007 | 1007 | $endpoint = $endpointBuilder('Search'); |
| 1008 | 1008 | $endpoint->setIndex($index) |
| 1009 | - ->setType($type) |
|
| 1010 | - ->setBody($body); |
|
| 1009 | + ->setType($type) |
|
| 1010 | + ->setBody($body); |
|
| 1011 | 1011 | $endpoint->setParams($params); |
| 1012 | 1012 | $response = $endpoint->performRequest(); |
| 1013 | 1013 | return $response['data']; |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | /** @var \Elasticsearch\Endpoints\SearchShards $endpoint */ |
| 1040 | 1040 | $endpoint = $endpointBuilder('SearchShards'); |
| 1041 | 1041 | $endpoint->setIndex($index) |
| 1042 | - ->setType($type); |
|
| 1042 | + ->setType($type); |
|
| 1043 | 1043 | $endpoint->setParams($params); |
| 1044 | 1044 | $response = $endpoint->performRequest(); |
| 1045 | 1045 | return $response['data']; |
@@ -1066,8 +1066,8 @@ discard block |
||
| 1066 | 1066 | /** @var \Elasticsearch\Endpoints\Search $endpoint */ |
| 1067 | 1067 | $endpoint = $endpointBuilder('SearchTemplate'); |
| 1068 | 1068 | $endpoint->setIndex($index) |
| 1069 | - ->setType($type) |
|
| 1070 | - ->setBody($body); |
|
| 1069 | + ->setType($type) |
|
| 1070 | + ->setBody($body); |
|
| 1071 | 1071 | $endpoint->setParams($params); |
| 1072 | 1072 | $response = $endpoint->performRequest(); |
| 1073 | 1073 | return $response['data']; |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | /** @var \Elasticsearch\Endpoints\Scroll $endpoint */ |
| 1096 | 1096 | $endpoint = $endpointBuilder('Scroll'); |
| 1097 | 1097 | $endpoint->setScrollID($scrollID) |
| 1098 | - ->setBody($body); |
|
| 1098 | + ->setBody($body); |
|
| 1099 | 1099 | $endpoint->setParams($params); |
| 1100 | 1100 | $response = $endpoint->performRequest(); |
| 1101 | 1101 | return $response['data']; |
@@ -1123,8 +1123,8 @@ discard block |
||
| 1123 | 1123 | /** @var \Elasticsearch\Endpoints\Scroll $endpoint */ |
| 1124 | 1124 | $endpoint = $endpointBuilder('Scroll'); |
| 1125 | 1125 | $endpoint->setScrollID($scrollID) |
| 1126 | - ->setBody($body) |
|
| 1127 | - ->setClearScroll(true); |
|
| 1126 | + ->setBody($body) |
|
| 1127 | + ->setClearScroll(true); |
|
| 1128 | 1128 | $endpoint->setParams($params); |
| 1129 | 1129 | $response = $endpoint->performRequest(); |
| 1130 | 1130 | return $response['data']; |
@@ -1176,9 +1176,9 @@ discard block |
||
| 1176 | 1176 | /** @var \Elasticsearch\Endpoints\Update $endpoint */ |
| 1177 | 1177 | $endpoint = $endpointBuilder('Update'); |
| 1178 | 1178 | $endpoint->setID($id) |
| 1179 | - ->setIndex($index) |
|
| 1180 | - ->setType($type) |
|
| 1181 | - ->setBody($body); |
|
| 1179 | + ->setIndex($index) |
|
| 1180 | + ->setType($type) |
|
| 1181 | + ->setBody($body); |
|
| 1182 | 1182 | $endpoint->setParams($params); |
| 1183 | 1183 | $response = $endpoint->performRequest(); |
| 1184 | 1184 | return $response['data']; |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | /** @var \Elasticsearch\Endpoints\Script\Get $endpoint */ |
| 1205 | 1205 | $endpoint = $endpointBuilder('Script\Get'); |
| 1206 | 1206 | $endpoint->setID($id) |
| 1207 | - ->setLang($lang); |
|
| 1207 | + ->setLang($lang); |
|
| 1208 | 1208 | $endpoint->setParams($params); |
| 1209 | 1209 | $response = $endpoint->performRequest(); |
| 1210 | 1210 | return $response['data']; |
@@ -1229,7 +1229,7 @@ discard block |
||
| 1229 | 1229 | /** @var \Elasticsearch\Endpoints\Script\Delete $endpoint */ |
| 1230 | 1230 | $endpoint = $endpointBuilder('Script\Delete'); |
| 1231 | 1231 | $endpoint->setID($id) |
| 1232 | - ->setLang($lang); |
|
| 1232 | + ->setLang($lang); |
|
| 1233 | 1233 | $endpoint->setParams($params); |
| 1234 | 1234 | $response = $endpoint->performRequest(); |
| 1235 | 1235 | return $response['data']; |
@@ -1255,8 +1255,8 @@ discard block |
||
| 1255 | 1255 | /** @var \Elasticsearch\Endpoints\Script\Put $endpoint */ |
| 1256 | 1256 | $endpoint = $endpointBuilder('Script\Put'); |
| 1257 | 1257 | $endpoint->setID($id) |
| 1258 | - ->setLang($lang) |
|
| 1259 | - ->setBody($body); |
|
| 1258 | + ->setLang($lang) |
|
| 1259 | + ->setBody($body); |
|
| 1260 | 1260 | $endpoint->setParams($params); |
| 1261 | 1261 | $response = $endpoint->performRequest(); |
| 1262 | 1262 | return $response['data']; |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | /** @var \Elasticsearch\Endpoints\Template\Put $endpoint */ |
| 1325 | 1325 | $endpoint = $endpointBuilder('Template\Put'); |
| 1326 | 1326 | $endpoint->setID($id) |
| 1327 | - ->setBody($body); |
|
| 1327 | + ->setBody($body); |
|
| 1328 | 1328 | $endpoint->setParams($params); |
| 1329 | 1329 | $response = $endpoint->performRequest(); |
| 1330 | 1330 | return $response['data']; |
@@ -1436,7 +1436,7 @@ discard block |
||
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | if ($this->params['logObject'] === null) { |
| 1439 | - $this->setDefaultLogger(); |
|
| 1439 | + $this->setDefaultLogger(); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | if ($this->params['traceObject'] === null) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param array $params Array of injectable parameters |
| 81 | 81 | */ |
| 82 | - public function __construct($params = array()) |
|
| 82 | + public function __construct($params = array ()) |
|
| 83 | 83 | { |
| 84 | 84 | $this->setParams($params); |
| 85 | 85 | $this->setLogging(); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return array |
| 276 | 276 | */ |
| 277 | - public function deleteByQuery($params = array()) |
|
| 277 | + public function deleteByQuery($params = array ()) |
|
| 278 | 278 | { |
| 279 | 279 | $index = $this->extractArgument($params, 'index'); |
| 280 | 280 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * |
| 317 | 317 | * @return array |
| 318 | 318 | */ |
| 319 | - public function count($params = array()) |
|
| 319 | + public function count($params = array ()) |
|
| 320 | 320 | { |
| 321 | 321 | $index = $this->extractArgument($params, 'index'); |
| 322 | 322 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * |
| 361 | 361 | * @return array |
| 362 | 362 | */ |
| 363 | - public function countPercolate($params = array()) |
|
| 363 | + public function countPercolate($params = array ()) |
|
| 364 | 364 | { |
| 365 | 365 | $index = $this->extractArgument($params, 'index'); |
| 366 | 366 | $type = $this->extractArgument($params, 'type'); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @return array |
| 429 | 429 | */ |
| 430 | - public function mpercolate($params = array()) |
|
| 430 | + public function mpercolate($params = array ()) |
|
| 431 | 431 | { |
| 432 | 432 | $index = $this->extractArgument($params, 'index'); |
| 433 | 433 | $type = $this->extractArgument($params, 'type'); |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * |
| 467 | 467 | * @return array |
| 468 | 468 | */ |
| 469 | - public function termvectors($params = array()) |
|
| 469 | + public function termvectors($params = array ()) |
|
| 470 | 470 | { |
| 471 | 471 | $index = $this->extractArgument($params, 'index'); |
| 472 | 472 | $type = $this->extractArgument($params, 'type'); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | * |
| 508 | 508 | * @return array |
| 509 | 509 | */ |
| 510 | - public function mtermvectors($params = array()) |
|
| 510 | + public function mtermvectors($params = array ()) |
|
| 511 | 511 | { |
| 512 | 512 | $index = $this->extractArgument($params, 'index'); |
| 513 | 513 | $type = $this->extractArgument($params, 'type'); |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @return array |
| 659 | 659 | */ |
| 660 | - public function mget($params = array()) |
|
| 660 | + public function mget($params = array ()) |
|
| 661 | 661 | { |
| 662 | 662 | $index = $this->extractArgument($params, 'index'); |
| 663 | 663 | |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | * |
| 694 | 694 | * @return array |
| 695 | 695 | */ |
| 696 | - public function msearch($params = array()) |
|
| 696 | + public function msearch($params = array ()) |
|
| 697 | 697 | { |
| 698 | 698 | $index = $this->extractArgument($params, 'index'); |
| 699 | 699 | |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | * |
| 784 | 784 | * @return array |
| 785 | 785 | */ |
| 786 | - public function bulk($params = array()) |
|
| 786 | + public function bulk($params = array ()) |
|
| 787 | 787 | { |
| 788 | 788 | $index = $this->extractArgument($params, 'index'); |
| 789 | 789 | |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | * |
| 874 | 874 | * @return array |
| 875 | 875 | */ |
| 876 | - public function suggest($params = array()) |
|
| 876 | + public function suggest($params = array ()) |
|
| 877 | 877 | { |
| 878 | 878 | $index = $this->extractArgument($params, 'index'); |
| 879 | 879 | |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | * |
| 989 | 989 | * @return array |
| 990 | 990 | */ |
| 991 | - public function search($params = array()) |
|
| 991 | + public function search($params = array ()) |
|
| 992 | 992 | { |
| 993 | 993 | $index = $this->extractArgument($params, 'index'); |
| 994 | 994 | |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | * |
| 1028 | 1028 | * @return array |
| 1029 | 1029 | */ |
| 1030 | - public function searchShards($params = array()) |
|
| 1030 | + public function searchShards($params = array ()) |
|
| 1031 | 1031 | { |
| 1032 | 1032 | $index = $this->extractArgument($params, 'index'); |
| 1033 | 1033 | $type = $this->extractArgument($params, 'type'); |
@@ -1054,7 +1054,7 @@ discard block |
||
| 1054 | 1054 | * |
| 1055 | 1055 | * @return array |
| 1056 | 1056 | */ |
| 1057 | - public function searchTemplate($params = array()) |
|
| 1057 | + public function searchTemplate($params = array ()) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | $index = $this->extractArgument($params, 'index'); |
| 1060 | 1060 | $type = $this->extractArgument($params, 'type'); |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | * |
| 1084 | 1084 | * @return array |
| 1085 | 1085 | */ |
| 1086 | - public function scroll($params = array()) |
|
| 1086 | + public function scroll($params = array ()) |
|
| 1087 | 1087 | { |
| 1088 | 1088 | $scrollID = $this->extractArgument($params, 'scroll_id'); |
| 1089 | 1089 | |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | * |
| 1112 | 1112 | * @return array |
| 1113 | 1113 | */ |
| 1114 | - public function clearScroll($params = array()) |
|
| 1114 | + public function clearScroll($params = array ()) |
|
| 1115 | 1115 | { |
| 1116 | 1116 | $scrollID = $this->extractArgument($params, 'scroll_id'); |
| 1117 | 1117 | |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | 1411 | if (isset($params['dic']) !== true) { |
| 1412 | - $dicBuilder = new DICBuilder($hosts, $params); |
|
| 1412 | + $dicBuilder = new DICBuilder($hosts, $params); |
|
| 1413 | 1413 | } else { |
| 1414 | 1414 | $dicBuilder = $params['dic']($hosts, $params); |
| 1415 | 1415 | unset($params['dic']); |
@@ -1489,7 +1489,7 @@ discard block |
||
| 1489 | 1489 | */ |
| 1490 | 1490 | private function getDefaultHost() |
| 1491 | 1491 | { |
| 1492 | - return array(array('host' => 'localhost', 'port' => 9200)); |
|
| 1492 | + return array (array ('host' => 'localhost', 'port' => 9200)); |
|
| 1493 | 1493 | } |
| 1494 | 1494 | |
| 1495 | 1495 | |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | throw new Exceptions\InvalidArgumentException('Hosts parameter must be an array of strings'); |
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | - $finalHosts = array(); |
|
| 1508 | + $finalHosts = array (); |
|
| 1509 | 1509 | foreach ($hosts as $host) { |
| 1510 | 1510 | $host = $this->prependMissingScheme($host); |
| 1511 | 1511 | $finalHosts[] = $this->extractURIParts($host); |
@@ -1559,7 +1559,7 @@ discard block |
||
| 1559 | 1559 | public function extractArgument(&$params, $arg) |
| 1560 | 1560 | { |
| 1561 | 1561 | if (is_object($params) === true) { |
| 1562 | - $params = (array)$params; |
|
| 1562 | + $params = (array) $params; |
|
| 1563 | 1563 | } |
| 1564 | 1564 | |
| 1565 | 1565 | if (isset($params[$arg]) === true) { |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 33 | 33 | * @link http://elasticsearch.org |
| 34 | 34 | */ |
| 35 | -class Client |
|
| 36 | -{ |
|
| 35 | +class Client { |
|
| 37 | 36 | |
| 38 | 37 | /** |
| 39 | 38 | * @var Transport |
@@ -79,8 +78,7 @@ discard block |
||
| 79 | 78 | * |
| 80 | 79 | * @param array $params Array of injectable parameters |
| 81 | 80 | */ |
| 82 | - public function __construct($params = array()) |
|
| 83 | - { |
|
| 81 | + public function __construct($params = array()) { |
|
| 84 | 82 | $this->setParams($params); |
| 85 | 83 | $this->setLogging(); |
| 86 | 84 | $this->transport = $this->params['transport']; |
@@ -98,8 +96,7 @@ discard block |
||
| 98 | 96 | * |
| 99 | 97 | * @return array |
| 100 | 98 | */ |
| 101 | - public function info() |
|
| 102 | - { |
|
| 99 | + public function info() { |
|
| 103 | 100 | |
| 104 | 101 | /** @var callback $endpointBuilder */ |
| 105 | 102 | $endpointBuilder = $this->dicEndpoints; |
@@ -111,8 +108,7 @@ discard block |
||
| 111 | 108 | } |
| 112 | 109 | |
| 113 | 110 | |
| 114 | - public function ping() |
|
| 115 | - { |
|
| 111 | + public function ping() { |
|
| 116 | 112 | |
| 117 | 113 | /** @var callback $endpointBuilder */ |
| 118 | 114 | $endpointBuilder = $this->dicEndpoints; |
@@ -153,8 +149,7 @@ discard block |
||
| 153 | 149 | * |
| 154 | 150 | * @return array |
| 155 | 151 | */ |
| 156 | - public function get($params) |
|
| 157 | - { |
|
| 152 | + public function get($params) { |
|
| 158 | 153 | $id = $this->extractArgument($params, 'id'); |
| 159 | 154 | |
| 160 | 155 | |
@@ -194,8 +189,7 @@ discard block |
||
| 194 | 189 | * |
| 195 | 190 | * @return array |
| 196 | 191 | */ |
| 197 | - public function getSource($params) |
|
| 198 | - { |
|
| 192 | + public function getSource($params) { |
|
| 199 | 193 | $id = $this->extractArgument($params, 'id'); |
| 200 | 194 | |
| 201 | 195 | |
@@ -237,8 +231,7 @@ discard block |
||
| 237 | 231 | * |
| 238 | 232 | * @return array |
| 239 | 233 | */ |
| 240 | - public function delete($params) |
|
| 241 | - { |
|
| 234 | + public function delete($params) { |
|
| 242 | 235 | $id = $this->extractArgument($params, 'id'); |
| 243 | 236 | |
| 244 | 237 | |
@@ -274,8 +267,7 @@ discard block |
||
| 274 | 267 | * |
| 275 | 268 | * @return array |
| 276 | 269 | */ |
| 277 | - public function deleteByQuery($params = array()) |
|
| 278 | - { |
|
| 270 | + public function deleteByQuery($params = array()) { |
|
| 279 | 271 | $index = $this->extractArgument($params, 'index'); |
| 280 | 272 | |
| 281 | 273 | |
@@ -316,8 +308,7 @@ discard block |
||
| 316 | 308 | * |
| 317 | 309 | * @return array |
| 318 | 310 | */ |
| 319 | - public function count($params = array()) |
|
| 320 | - { |
|
| 311 | + public function count($params = array()) { |
|
| 321 | 312 | $index = $this->extractArgument($params, 'index'); |
| 322 | 313 | |
| 323 | 314 | |
@@ -360,8 +351,7 @@ discard block |
||
| 360 | 351 | * |
| 361 | 352 | * @return array |
| 362 | 353 | */ |
| 363 | - public function countPercolate($params = array()) |
|
| 364 | - { |
|
| 354 | + public function countPercolate($params = array()) { |
|
| 365 | 355 | $index = $this->extractArgument($params, 'index'); |
| 366 | 356 | $type = $this->extractArgument($params, 'type'); |
| 367 | 357 | $id = $this->extractArgument($params, 'id'); |
@@ -392,8 +382,7 @@ discard block |
||
| 392 | 382 | * |
| 393 | 383 | * @return array |
| 394 | 384 | */ |
| 395 | - public function percolate($params) |
|
| 396 | - { |
|
| 385 | + public function percolate($params) { |
|
| 397 | 386 | $index = $this->extractArgument($params, 'index'); |
| 398 | 387 | $type = $this->extractArgument($params, 'type'); |
| 399 | 388 | $id = $this->extractArgument($params, 'id'); |
@@ -427,8 +416,7 @@ discard block |
||
| 427 | 416 | * |
| 428 | 417 | * @return array |
| 429 | 418 | */ |
| 430 | - public function mpercolate($params = array()) |
|
| 431 | - { |
|
| 419 | + public function mpercolate($params = array()) { |
|
| 432 | 420 | $index = $this->extractArgument($params, 'index'); |
| 433 | 421 | $type = $this->extractArgument($params, 'type'); |
| 434 | 422 | $body = $this->extractArgument($params, 'body'); |
@@ -466,8 +454,7 @@ discard block |
||
| 466 | 454 | * |
| 467 | 455 | * @return array |
| 468 | 456 | */ |
| 469 | - public function termvectors($params = array()) |
|
| 470 | - { |
|
| 457 | + public function termvectors($params = array()) { |
|
| 471 | 458 | $index = $this->extractArgument($params, 'index'); |
| 472 | 459 | $type = $this->extractArgument($params, 'type'); |
| 473 | 460 | $id = $this->extractArgument($params, 'id'); |
@@ -507,8 +494,7 @@ discard block |
||
| 507 | 494 | * |
| 508 | 495 | * @return array |
| 509 | 496 | */ |
| 510 | - public function mtermvectors($params = array()) |
|
| 511 | - { |
|
| 497 | + public function mtermvectors($params = array()) { |
|
| 512 | 498 | $index = $this->extractArgument($params, 'index'); |
| 513 | 499 | $type = $this->extractArgument($params, 'type'); |
| 514 | 500 | $body = $this->extractArgument($params, 'body'); |
@@ -541,8 +527,7 @@ discard block |
||
| 541 | 527 | * |
| 542 | 528 | * @return array |
| 543 | 529 | */ |
| 544 | - public function exists($params) |
|
| 545 | - { |
|
| 530 | + public function exists($params) { |
|
| 546 | 531 | $id = $this->extractArgument($params, 'id'); |
| 547 | 532 | |
| 548 | 533 | |
@@ -609,8 +594,7 @@ discard block |
||
| 609 | 594 | * |
| 610 | 595 | * @return array |
| 611 | 596 | */ |
| 612 | - public function mlt($params) |
|
| 613 | - { |
|
| 597 | + public function mlt($params) { |
|
| 614 | 598 | $id = $this->extractArgument($params, 'id'); |
| 615 | 599 | |
| 616 | 600 | |
@@ -657,8 +641,7 @@ discard block |
||
| 657 | 641 | * |
| 658 | 642 | * @return array |
| 659 | 643 | */ |
| 660 | - public function mget($params = array()) |
|
| 661 | - { |
|
| 644 | + public function mget($params = array()) { |
|
| 662 | 645 | $index = $this->extractArgument($params, 'index'); |
| 663 | 646 | |
| 664 | 647 | |
@@ -693,8 +676,7 @@ discard block |
||
| 693 | 676 | * |
| 694 | 677 | * @return array |
| 695 | 678 | */ |
| 696 | - public function msearch($params = array()) |
|
| 697 | - { |
|
| 679 | + public function msearch($params = array()) { |
|
| 698 | 680 | $index = $this->extractArgument($params, 'index'); |
| 699 | 681 | |
| 700 | 682 | |
@@ -740,8 +722,7 @@ discard block |
||
| 740 | 722 | * |
| 741 | 723 | * @return array |
| 742 | 724 | */ |
| 743 | - public function create($params) |
|
| 744 | - { |
|
| 725 | + public function create($params) { |
|
| 745 | 726 | $id = $this->extractArgument($params, 'id'); |
| 746 | 727 | |
| 747 | 728 | |
@@ -783,8 +764,7 @@ discard block |
||
| 783 | 764 | * |
| 784 | 765 | * @return array |
| 785 | 766 | */ |
| 786 | - public function bulk($params = array()) |
|
| 787 | - { |
|
| 767 | + public function bulk($params = array()) { |
|
| 788 | 768 | $index = $this->extractArgument($params, 'index'); |
| 789 | 769 | |
| 790 | 770 | |
@@ -831,8 +811,7 @@ discard block |
||
| 831 | 811 | * |
| 832 | 812 | * @return array |
| 833 | 813 | */ |
| 834 | - public function index($params) |
|
| 835 | - { |
|
| 814 | + public function index($params) { |
|
| 836 | 815 | $id = $this->extractArgument($params, 'id'); |
| 837 | 816 | |
| 838 | 817 | |
@@ -873,8 +852,7 @@ discard block |
||
| 873 | 852 | * |
| 874 | 853 | * @return array |
| 875 | 854 | */ |
| 876 | - public function suggest($params = array()) |
|
| 877 | - { |
|
| 855 | + public function suggest($params = array()) { |
|
| 878 | 856 | $index = $this->extractArgument($params, 'index'); |
| 879 | 857 | |
| 880 | 858 | |
@@ -920,8 +898,7 @@ discard block |
||
| 920 | 898 | * |
| 921 | 899 | * @return array |
| 922 | 900 | */ |
| 923 | - public function explain($params) |
|
| 924 | - { |
|
| 901 | + public function explain($params) { |
|
| 925 | 902 | $id = $this->extractArgument($params, 'id'); |
| 926 | 903 | |
| 927 | 904 | |
@@ -988,8 +965,7 @@ discard block |
||
| 988 | 965 | * |
| 989 | 966 | * @return array |
| 990 | 967 | */ |
| 991 | - public function search($params = array()) |
|
| 992 | - { |
|
| 968 | + public function search($params = array()) { |
|
| 993 | 969 | $index = $this->extractArgument($params, 'index'); |
| 994 | 970 | |
| 995 | 971 | |
@@ -1027,8 +1003,7 @@ discard block |
||
| 1027 | 1003 | * |
| 1028 | 1004 | * @return array |
| 1029 | 1005 | */ |
| 1030 | - public function searchShards($params = array()) |
|
| 1031 | - { |
|
| 1006 | + public function searchShards($params = array()) { |
|
| 1032 | 1007 | $index = $this->extractArgument($params, 'index'); |
| 1033 | 1008 | $type = $this->extractArgument($params, 'type'); |
| 1034 | 1009 | |
@@ -1054,8 +1029,7 @@ discard block |
||
| 1054 | 1029 | * |
| 1055 | 1030 | * @return array |
| 1056 | 1031 | */ |
| 1057 | - public function searchTemplate($params = array()) |
|
| 1058 | - { |
|
| 1032 | + public function searchTemplate($params = array()) { |
|
| 1059 | 1033 | $index = $this->extractArgument($params, 'index'); |
| 1060 | 1034 | $type = $this->extractArgument($params, 'type'); |
| 1061 | 1035 | $body = $this->extractArgument($params, 'body'); |
@@ -1083,8 +1057,7 @@ discard block |
||
| 1083 | 1057 | * |
| 1084 | 1058 | * @return array |
| 1085 | 1059 | */ |
| 1086 | - public function scroll($params = array()) |
|
| 1087 | - { |
|
| 1060 | + public function scroll($params = array()) { |
|
| 1088 | 1061 | $scrollID = $this->extractArgument($params, 'scroll_id'); |
| 1089 | 1062 | |
| 1090 | 1063 | $body = $this->extractArgument($params, 'body'); |
@@ -1111,8 +1084,7 @@ discard block |
||
| 1111 | 1084 | * |
| 1112 | 1085 | * @return array |
| 1113 | 1086 | */ |
| 1114 | - public function clearScroll($params = array()) |
|
| 1115 | - { |
|
| 1087 | + public function clearScroll($params = array()) { |
|
| 1116 | 1088 | $scrollID = $this->extractArgument($params, 'scroll_id'); |
| 1117 | 1089 | |
| 1118 | 1090 | $body = $this->extractArgument($params, 'body'); |
@@ -1155,8 +1127,7 @@ discard block |
||
| 1155 | 1127 | * |
| 1156 | 1128 | * @return array |
| 1157 | 1129 | */ |
| 1158 | - public function update($params) |
|
| 1159 | - { |
|
| 1130 | + public function update($params) { |
|
| 1160 | 1131 | $id = $this->extractArgument($params, 'id'); |
| 1161 | 1132 | |
| 1162 | 1133 | |
@@ -1193,8 +1164,7 @@ discard block |
||
| 1193 | 1164 | * |
| 1194 | 1165 | * @return array |
| 1195 | 1166 | */ |
| 1196 | - public function getScript($params) |
|
| 1197 | - { |
|
| 1167 | + public function getScript($params) { |
|
| 1198 | 1168 | $id = $this->extractArgument($params, 'id'); |
| 1199 | 1169 | $lang = $this->extractArgument($params, 'lang'); |
| 1200 | 1170 | |
@@ -1218,8 +1188,7 @@ discard block |
||
| 1218 | 1188 | * |
| 1219 | 1189 | * @return array |
| 1220 | 1190 | */ |
| 1221 | - public function deleteScript($params) |
|
| 1222 | - { |
|
| 1191 | + public function deleteScript($params) { |
|
| 1223 | 1192 | $id = $this->extractArgument($params, 'id'); |
| 1224 | 1193 | $lang = $this->extractArgument($params, 'lang'); |
| 1225 | 1194 | |
@@ -1243,8 +1212,7 @@ discard block |
||
| 1243 | 1212 | * |
| 1244 | 1213 | * @return array |
| 1245 | 1214 | */ |
| 1246 | - public function putScript($params) |
|
| 1247 | - { |
|
| 1215 | + public function putScript($params) { |
|
| 1248 | 1216 | $id = $this->extractArgument($params, 'id'); |
| 1249 | 1217 | $lang = $this->extractArgument($params, 'lang'); |
| 1250 | 1218 | $body = $this->extractArgument($params, 'body'); |
@@ -1269,8 +1237,7 @@ discard block |
||
| 1269 | 1237 | * |
| 1270 | 1238 | * @return array |
| 1271 | 1239 | */ |
| 1272 | - public function getTemplate($params) |
|
| 1273 | - { |
|
| 1240 | + public function getTemplate($params) { |
|
| 1274 | 1241 | $id = $this->extractArgument($params, 'id'); |
| 1275 | 1242 | |
| 1276 | 1243 | /** @var callback $endpointBuilder */ |
@@ -1291,8 +1258,7 @@ discard block |
||
| 1291 | 1258 | * |
| 1292 | 1259 | * @return array |
| 1293 | 1260 | */ |
| 1294 | - public function deleteTemplate($params) |
|
| 1295 | - { |
|
| 1261 | + public function deleteTemplate($params) { |
|
| 1296 | 1262 | $id = $this->extractArgument($params, 'id'); |
| 1297 | 1263 | |
| 1298 | 1264 | /** @var callback $endpointBuilder */ |
@@ -1313,8 +1279,7 @@ discard block |
||
| 1313 | 1279 | * |
| 1314 | 1280 | * @return array |
| 1315 | 1281 | */ |
| 1316 | - public function putTemplate($params) |
|
| 1317 | - { |
|
| 1282 | + public function putTemplate($params) { |
|
| 1318 | 1283 | $id = $this->extractArgument($params, 'id'); |
| 1319 | 1284 | $body = $this->extractArgument($params, 'body'); |
| 1320 | 1285 | |
@@ -1337,8 +1302,7 @@ discard block |
||
| 1337 | 1302 | * |
| 1338 | 1303 | * @return IndicesNamespace |
| 1339 | 1304 | */ |
| 1340 | - public function indices() |
|
| 1341 | - { |
|
| 1305 | + public function indices() { |
|
| 1342 | 1306 | return $this->indices; |
| 1343 | 1307 | } |
| 1344 | 1308 | |
@@ -1348,8 +1312,7 @@ discard block |
||
| 1348 | 1312 | * |
| 1349 | 1313 | * @return ClusterNamespace |
| 1350 | 1314 | */ |
| 1351 | - public function cluster() |
|
| 1352 | - { |
|
| 1315 | + public function cluster() { |
|
| 1353 | 1316 | return $this->cluster; |
| 1354 | 1317 | } |
| 1355 | 1318 | |
@@ -1359,8 +1322,7 @@ discard block |
||
| 1359 | 1322 | * |
| 1360 | 1323 | * @return NodesNamespace |
| 1361 | 1324 | */ |
| 1362 | - public function nodes() |
|
| 1363 | - { |
|
| 1325 | + public function nodes() { |
|
| 1364 | 1326 | return $this->nodes; |
| 1365 | 1327 | } |
| 1366 | 1328 | |
@@ -1370,8 +1332,7 @@ discard block |
||
| 1370 | 1332 | * |
| 1371 | 1333 | * @return SnapshotNamespace |
| 1372 | 1334 | */ |
| 1373 | - public function snapshot() |
|
| 1374 | - { |
|
| 1335 | + public function snapshot() { |
|
| 1375 | 1336 | return $this->snapshot; |
| 1376 | 1337 | } |
| 1377 | 1338 | |
@@ -1381,8 +1342,7 @@ discard block |
||
| 1381 | 1342 | * |
| 1382 | 1343 | * @return CatNamespace |
| 1383 | 1344 | */ |
| 1384 | - public function cat() |
|
| 1385 | - { |
|
| 1345 | + public function cat() { |
|
| 1386 | 1346 | return $this->cat; |
| 1387 | 1347 | } |
| 1388 | 1348 | |
@@ -1398,8 +1358,7 @@ discard block |
||
| 1398 | 1358 | * @internal param array $hosts Array of hosts |
| 1399 | 1359 | * @return void |
| 1400 | 1360 | */ |
| 1401 | - private function setParams($params) |
|
| 1402 | - { |
|
| 1361 | + private function setParams($params) { |
|
| 1403 | 1362 | |
| 1404 | 1363 | if (isset($params['hosts']) === true) { |
| 1405 | 1364 | $hosts = $this->buildHostsFromSeed($params['hosts']); |
@@ -1428,8 +1387,7 @@ discard block |
||
| 1428 | 1387 | * |
| 1429 | 1388 | * @return void |
| 1430 | 1389 | */ |
| 1431 | - private function setLogging() |
|
| 1432 | - { |
|
| 1390 | + private function setLogging() { |
|
| 1433 | 1391 | if ($this->params['logging'] !== true) { |
| 1434 | 1392 | $this->setEmptyLogger(); |
| 1435 | 1393 | return; |
@@ -1445,14 +1403,12 @@ discard block |
||
| 1445 | 1403 | |
| 1446 | 1404 | } |
| 1447 | 1405 | |
| 1448 | - private function setEmptyLogger() |
|
| 1449 | - { |
|
| 1406 | + private function setEmptyLogger() { |
|
| 1450 | 1407 | $this->params['logObject'] = new EmptyLogger(); |
| 1451 | 1408 | $this->params['traceObject'] = new EmptyLogger(); |
| 1452 | 1409 | } |
| 1453 | 1410 | |
| 1454 | - private function setDefaultLogger() |
|
| 1455 | - { |
|
| 1411 | + private function setDefaultLogger() { |
|
| 1456 | 1412 | $log = new Logger('log'); |
| 1457 | 1413 | $handler = new StreamHandler( |
| 1458 | 1414 | $this->params['logPath'], |
@@ -1468,8 +1424,7 @@ discard block |
||
| 1468 | 1424 | $this->params['logObject'] = $log; |
| 1469 | 1425 | } |
| 1470 | 1426 | |
| 1471 | - private function setDefaultTracer() |
|
| 1472 | - { |
|
| 1427 | + private function setDefaultTracer() { |
|
| 1473 | 1428 | $trace = new Logger('trace'); |
| 1474 | 1429 | $traceHandler = new StreamHandler( |
| 1475 | 1430 | $this->params['tracePath'], |
@@ -1487,8 +1442,7 @@ discard block |
||
| 1487 | 1442 | /** |
| 1488 | 1443 | * @return array |
| 1489 | 1444 | */ |
| 1490 | - private function getDefaultHost() |
|
| 1491 | - { |
|
| 1445 | + private function getDefaultHost() { |
|
| 1492 | 1446 | return array(array('host' => 'localhost', 'port' => 9200)); |
| 1493 | 1447 | } |
| 1494 | 1448 | |
@@ -1499,8 +1453,7 @@ discard block |
||
| 1499 | 1453 | * @return array |
| 1500 | 1454 | * @throws Common\Exceptions\InvalidArgumentException |
| 1501 | 1455 | */ |
| 1502 | - private function buildHostsFromSeed($hosts) |
|
| 1503 | - { |
|
| 1456 | + private function buildHostsFromSeed($hosts) { |
|
| 1504 | 1457 | if (is_array($hosts) === false) { |
| 1505 | 1458 | throw new Exceptions\InvalidArgumentException('Hosts parameter must be an array of strings'); |
| 1506 | 1459 | } |
@@ -1521,8 +1474,7 @@ discard block |
||
| 1521 | 1474 | * @return array |
| 1522 | 1475 | * @throws Common\Exceptions\InvalidArgumentException |
| 1523 | 1476 | */ |
| 1524 | - private function extractURIParts($host) |
|
| 1525 | - { |
|
| 1477 | + private function extractURIParts($host) { |
|
| 1526 | 1478 | |
| 1527 | 1479 | $parts = parse_url($host); |
| 1528 | 1480 | |
@@ -1556,8 +1508,7 @@ discard block |
||
| 1556 | 1508 | * |
| 1557 | 1509 | * @return null|mixed |
| 1558 | 1510 | */ |
| 1559 | - public function extractArgument(&$params, $arg) |
|
| 1560 | - { |
|
| 1511 | + public function extractArgument(&$params, $arg) { |
|
| 1561 | 1512 | if (is_object($params) === true) { |
| 1562 | 1513 | $params = (array)$params; |
| 1563 | 1514 | } |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | try { |
| 124 | 124 | $response = $endpoint->performRequest(); |
| 125 | 125 | } catch (Missing404Exception $exception) { |
| 126 | - return false; |
|
| 126 | + return FALSE; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if (isset($response['status']) === true && $response['status'] === 200) { |
|
| 130 | - return true; |
|
| 129 | + if (isset($response['status']) === TRUE && $response['status'] === 200) { |
|
| 130 | + return TRUE; |
|
| 131 | 131 | } else { |
| 132 | - return false; |
|
| 132 | + return FALSE; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -566,16 +566,16 @@ discard block |
||
| 566 | 566 | try { |
| 567 | 567 | $response = $endpoint->performRequest(); |
| 568 | 568 | } catch (Missing404Exception $exception) { |
| 569 | - return false; |
|
| 569 | + return FALSE; |
|
| 570 | 570 | } catch (RoutingMissingException $exception) { |
| 571 | - return false; |
|
| 571 | + return FALSE; |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
| 575 | 575 | if ($response['status'] === 200) { |
| 576 | - return true; |
|
| 576 | + return TRUE; |
|
| 577 | 577 | } else { |
| 578 | - return false; |
|
| 578 | + return FALSE; |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | $endpoint = $endpointBuilder('Scroll'); |
| 1125 | 1125 | $endpoint->setScrollID($scrollID) |
| 1126 | 1126 | ->setBody($body) |
| 1127 | - ->setClearScroll(true); |
|
| 1127 | + ->setClearScroll(TRUE); |
|
| 1128 | 1128 | $endpoint->setParams($params); |
| 1129 | 1129 | $response = $endpoint->performRequest(); |
| 1130 | 1130 | return $response['data']; |
@@ -1401,14 +1401,14 @@ discard block |
||
| 1401 | 1401 | private function setParams($params) |
| 1402 | 1402 | { |
| 1403 | 1403 | |
| 1404 | - if (isset($params['hosts']) === true) { |
|
| 1404 | + if (isset($params['hosts']) === TRUE) { |
|
| 1405 | 1405 | $hosts = $this->buildHostsFromSeed($params['hosts']); |
| 1406 | 1406 | unset($params['hosts']); |
| 1407 | 1407 | } else { |
| 1408 | 1408 | $hosts = $this->getDefaultHost(); |
| 1409 | 1409 | } |
| 1410 | 1410 | |
| 1411 | - if (isset($params['dic']) !== true) { |
|
| 1411 | + if (isset($params['dic']) !== TRUE) { |
|
| 1412 | 1412 | $dicBuilder = new DICBuilder($hosts, $params); |
| 1413 | 1413 | } else { |
| 1414 | 1414 | $dicBuilder = $params['dic']($hosts, $params); |
@@ -1430,16 +1430,16 @@ discard block |
||
| 1430 | 1430 | */ |
| 1431 | 1431 | private function setLogging() |
| 1432 | 1432 | { |
| 1433 | - if ($this->params['logging'] !== true) { |
|
| 1433 | + if ($this->params['logging'] !== TRUE) { |
|
| 1434 | 1434 | $this->setEmptyLogger(); |
| 1435 | 1435 | return; |
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | - if ($this->params['logObject'] === null) { |
|
| 1438 | + if ($this->params['logObject'] === NULL) { |
|
| 1439 | 1439 | $this->setDefaultLogger(); |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | - if ($this->params['traceObject'] === null) { |
|
| 1442 | + if ($this->params['traceObject'] === NULL) { |
|
| 1443 | 1443 | $this->setDefaultTracer(); |
| 1444 | 1444 | } |
| 1445 | 1445 | |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | */ |
| 1502 | 1502 | private function buildHostsFromSeed($hosts) |
| 1503 | 1503 | { |
| 1504 | - if (is_array($hosts) === false) { |
|
| 1504 | + if (is_array($hosts) === FALSE) { |
|
| 1505 | 1505 | throw new Exceptions\InvalidArgumentException('Hosts parameter must be an array of strings'); |
| 1506 | 1506 | } |
| 1507 | 1507 | |
@@ -1526,11 +1526,11 @@ discard block |
||
| 1526 | 1526 | |
| 1527 | 1527 | $parts = parse_url($host); |
| 1528 | 1528 | |
| 1529 | - if ($parts === false) { |
|
| 1529 | + if ($parts === FALSE) { |
|
| 1530 | 1530 | throw new Exceptions\InvalidArgumentException("Could not parse URI"); |
| 1531 | 1531 | } |
| 1532 | 1532 | |
| 1533 | - if (isset($parts['port']) !== true) { |
|
| 1533 | + if (isset($parts['port']) !== TRUE) { |
|
| 1534 | 1534 | $parts['port'] = 9200; |
| 1535 | 1535 | } |
| 1536 | 1536 | |
@@ -1558,16 +1558,16 @@ discard block |
||
| 1558 | 1558 | */ |
| 1559 | 1559 | public function extractArgument(&$params, $arg) |
| 1560 | 1560 | { |
| 1561 | - if (is_object($params) === true) { |
|
| 1561 | + if (is_object($params) === TRUE) { |
|
| 1562 | 1562 | $params = (array)$params; |
| 1563 | 1563 | } |
| 1564 | 1564 | |
| 1565 | - if (isset($params[$arg]) === true) { |
|
| 1565 | + if (isset($params[$arg]) === TRUE) { |
|
| 1566 | 1566 | $val = $params[$arg]; |
| 1567 | 1567 | unset($params[$arg]); |
| 1568 | 1568 | return $val; |
| 1569 | 1569 | } else { |
| 1570 | - return null; |
|
| 1570 | + return NULL; |
|
| 1571 | 1571 | } |
| 1572 | 1572 | } |
| 1573 | 1573 | |
@@ -200,7 +200,7 @@ |
||
| 200 | 200 | $uri[] = $endpoint; |
| 201 | 201 | $uri = array_filter($uri); |
| 202 | 202 | |
| 203 | - return '/' . implode('/', $uri); |
|
| 203 | + return '/' . implode('/', $uri); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | abstract class AbstractEndpoint |
| 19 | 19 | { |
| 20 | 20 | /** @var array */ |
| 21 | - protected $params = array(); |
|
| 21 | + protected $params = array (); |
|
| 22 | 22 | |
| 23 | 23 | /** @var string */ |
| 24 | 24 | protected $index = null; |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function performRequest() |
| 77 | 77 | { |
| 78 | - $result = array(); |
|
| 78 | + $result = array (); |
|
| 79 | 79 | |
| 80 | 80 | try { |
| 81 | - $result = $this->transport->performRequest( |
|
| 81 | + $result = $this->transport->performRequest( |
|
| 82 | 82 | $this->getMethod(), |
| 83 | 83 | $this->getURI(), |
| 84 | 84 | $this->params, |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | throw $exception; |
| 93 | 93 | } else { |
| 94 | 94 | //TODO return null or dedicated object here instead? |
| 95 | - return array('data' => $exception->getMessage()); |
|
| 95 | + return array ('data' => $exception->getMessage()); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function setParams($params) |
| 110 | 110 | { |
| 111 | 111 | if (is_object($params) === true) { |
| 112 | - $params = (array)$params; |
|
| 112 | + $params = (array) $params; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $this->checkUserParams($params); |
@@ -194,11 +194,11 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | protected function getOptionalURI($endpoint) |
| 196 | 196 | { |
| 197 | - $uri = array(); |
|
| 197 | + $uri = array (); |
|
| 198 | 198 | $uri[] = $this->getOptionalIndex(); |
| 199 | 199 | $uri[] = $this->getOptionalType(); |
| 200 | 200 | $uri[] = $endpoint; |
| 201 | - $uri = array_filter($uri); |
|
| 201 | + $uri = array_filter($uri); |
|
| 202 | 202 | |
| 203 | 203 | return '/' . implode('/', $uri); |
| 204 | 204 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | private function getOptionalIndex() |
| 211 | 211 | { |
| 212 | - if (isset($this->index) === true){ |
|
| 212 | + if (isset($this->index) === true) { |
|
| 213 | 213 | return $this->index; |
| 214 | 214 | } else { |
| 215 | 215 | return '_all'; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | private function getOptionalType() |
| 224 | 224 | { |
| 225 | - if (isset($this->type) === true){ |
|
| 225 | + if (isset($this->type) === true) { |
|
| 226 | 226 | return $this->type; |
| 227 | 227 | } else { |
| 228 | 228 | return ''; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | return; //no params, just return. |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $whitelist = array_merge($this->getParamWhitelist(), array('ignore', 'custom', 'curlOpts')); |
|
| 262 | + $whitelist = array_merge($this->getParamWhitelist(), array ('ignore', 'custom', 'curlOpts')); |
|
| 263 | 263 | |
| 264 | 264 | foreach ($params as $key => $value) { |
| 265 | 265 | if (array_search($key, $whitelist) === false) { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | { |
| 299 | 299 | foreach ($params as &$param) { |
| 300 | 300 | if (is_array($param) === true) { |
| 301 | - if ($this->isNestedArray($param) !== true){ |
|
| 301 | + if ($this->isNestedArray($param) !== true) { |
|
| 302 | 302 | $param = implode(",", $param); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | * Class AbstractEndpoint |
| 16 | 16 | * @package Elasticsearch\Endpoints |
| 17 | 17 | */ |
| 18 | -abstract class AbstractEndpoint |
|
| 19 | -{ |
|
| 18 | +abstract class AbstractEndpoint { |
|
| 20 | 19 | /** @var array */ |
| 21 | 20 | protected $params = array(); |
| 22 | 21 | |
@@ -62,8 +61,7 @@ discard block |
||
| 62 | 61 | /** |
| 63 | 62 | * @param Transport $transport |
| 64 | 63 | */ |
| 65 | - public function __construct($transport) |
|
| 66 | - { |
|
| 64 | + public function __construct($transport) { |
|
| 67 | 65 | $this->transport = $transport; |
| 68 | 66 | } |
| 69 | 67 | |
@@ -73,8 +71,7 @@ discard block |
||
| 73 | 71 | * @throws \Exception |
| 74 | 72 | * @return array |
| 75 | 73 | */ |
| 76 | - public function performRequest() |
|
| 77 | - { |
|
| 74 | + public function performRequest() { |
|
| 78 | 75 | $result = array(); |
| 79 | 76 | |
| 80 | 77 | try { |
@@ -106,8 +103,7 @@ discard block |
||
| 106 | 103 | * @param string[] $params Array of parameters |
| 107 | 104 | * @return $this |
| 108 | 105 | */ |
| 109 | - public function setParams($params) |
|
| 110 | - { |
|
| 106 | + public function setParams($params) { |
|
| 111 | 107 | if (is_object($params) === true) { |
| 112 | 108 | $params = (array)$params; |
| 113 | 109 | } |
@@ -125,8 +121,7 @@ discard block |
||
| 125 | 121 | * |
| 126 | 122 | * @return $this |
| 127 | 123 | */ |
| 128 | - public function setIndex($index) |
|
| 129 | - { |
|
| 124 | + public function setIndex($index) { |
|
| 130 | 125 | if ($index === null) { |
| 131 | 126 | return $this; |
| 132 | 127 | } |
@@ -146,8 +141,7 @@ discard block |
||
| 146 | 141 | * |
| 147 | 142 | * @return $this |
| 148 | 143 | */ |
| 149 | - public function setType($type) |
|
| 150 | - { |
|
| 144 | + public function setType($type) { |
|
| 151 | 145 | if ($type === null) { |
| 152 | 146 | return $this; |
| 153 | 147 | } |
@@ -167,8 +161,7 @@ discard block |
||
| 167 | 161 | * |
| 168 | 162 | * @return $this |
| 169 | 163 | */ |
| 170 | - public function setID($docID) |
|
| 171 | - { |
|
| 164 | + public function setID($docID) { |
|
| 172 | 165 | if ($docID === null) { |
| 173 | 166 | return $this; |
| 174 | 167 | } |
@@ -181,8 +174,7 @@ discard block |
||
| 181 | 174 | /** |
| 182 | 175 | * @return array |
| 183 | 176 | */ |
| 184 | - protected function getBody() |
|
| 185 | - { |
|
| 177 | + protected function getBody() { |
|
| 186 | 178 | return $this->body; |
| 187 | 179 | } |
| 188 | 180 | |
@@ -192,8 +184,7 @@ discard block |
||
| 192 | 184 | * |
| 193 | 185 | * @return string |
| 194 | 186 | */ |
| 195 | - protected function getOptionalURI($endpoint) |
|
| 196 | - { |
|
| 187 | + protected function getOptionalURI($endpoint) { |
|
| 197 | 188 | $uri = array(); |
| 198 | 189 | $uri[] = $this->getOptionalIndex(); |
| 199 | 190 | $uri[] = $this->getOptionalType(); |
@@ -207,9 +198,8 @@ discard block |
||
| 207 | 198 | /** |
| 208 | 199 | * @return string |
| 209 | 200 | */ |
| 210 | - private function getOptionalIndex() |
|
| 211 | - { |
|
| 212 | - if (isset($this->index) === true){ |
|
| 201 | + private function getOptionalIndex() { |
|
| 202 | + if (isset($this->index) === true) { |
|
| 213 | 203 | return $this->index; |
| 214 | 204 | } else { |
| 215 | 205 | return '_all'; |
@@ -220,9 +210,8 @@ discard block |
||
| 220 | 210 | /** |
| 221 | 211 | * @return string |
| 222 | 212 | */ |
| 223 | - private function getOptionalType() |
|
| 224 | - { |
|
| 225 | - if (isset($this->type) === true){ |
|
| 213 | + private function getOptionalType() { |
|
| 214 | + if (isset($this->type) === true) { |
|
| 226 | 215 | return $this->type; |
| 227 | 216 | } else { |
| 228 | 217 | return ''; |
@@ -236,8 +225,7 @@ discard block |
||
| 236 | 225 | * |
| 237 | 226 | * @throws \Elasticsearch\Common\Exceptions\UnexpectedValueException |
| 238 | 227 | */ |
| 239 | - private function checkUserParams($params) |
|
| 240 | - { |
|
| 228 | + private function checkUserParams($params) { |
|
| 241 | 229 | try { |
| 242 | 230 | $this->ifParamsInvalidThrowException($params); |
| 243 | 231 | } catch (UnexpectedValueException $exception) { |
@@ -253,8 +241,7 @@ discard block |
||
| 253 | 241 | * @throws \Elasticsearch\Common\Exceptions\UnexpectedValueException |
| 254 | 242 | * |
| 255 | 243 | */ |
| 256 | - private function ifParamsInvalidThrowException($params) |
|
| 257 | - { |
|
| 244 | + private function ifParamsInvalidThrowException($params) { |
|
| 258 | 245 | if (isset($params) !== true) { |
| 259 | 246 | return; //no params, just return. |
| 260 | 247 | } |
@@ -274,16 +261,14 @@ discard block |
||
| 274 | 261 | } |
| 275 | 262 | |
| 276 | 263 | |
| 277 | - private function extractIgnore() |
|
| 278 | - { |
|
| 264 | + private function extractIgnore() { |
|
| 279 | 265 | if (isset($this->params['ignore']) === true) { |
| 280 | 266 | $this->ignore = explode(",", $this->params['ignore']); |
| 281 | 267 | unset($this->params['ignore']); |
| 282 | 268 | } |
| 283 | 269 | } |
| 284 | 270 | |
| 285 | - private function convertCustom($params) |
|
| 286 | - { |
|
| 271 | + private function convertCustom($params) { |
|
| 287 | 272 | if (isset($params['custom']) === true) { |
| 288 | 273 | foreach ($params['custom'] as $k => $v) { |
| 289 | 274 | $params[$k] = $v; |
@@ -294,11 +279,10 @@ discard block |
||
| 294 | 279 | } |
| 295 | 280 | |
| 296 | 281 | |
| 297 | - private function convertArraysToStrings($params) |
|
| 298 | - { |
|
| 282 | + private function convertArraysToStrings($params) { |
|
| 299 | 283 | foreach ($params as &$param) { |
| 300 | 284 | if (is_array($param) === true) { |
| 301 | - if ($this->isNestedArray($param) !== true){ |
|
| 285 | + if ($this->isNestedArray($param) !== true) { |
|
| 302 | 286 | $param = implode(",", $param); |
| 303 | 287 | } |
| 304 | 288 | |
@@ -21,25 +21,25 @@ discard block |
||
| 21 | 21 | protected $params = array(); |
| 22 | 22 | |
| 23 | 23 | /** @var string */ |
| 24 | - protected $index = null; |
|
| 24 | + protected $index = NULL; |
|
| 25 | 25 | |
| 26 | 26 | /** @var string */ |
| 27 | - protected $type = null; |
|
| 27 | + protected $type = NULL; |
|
| 28 | 28 | |
| 29 | 29 | /** @var string|int */ |
| 30 | - protected $id = null; |
|
| 30 | + protected $id = NULL; |
|
| 31 | 31 | |
| 32 | 32 | /** @var string */ |
| 33 | - protected $method = null; |
|
| 33 | + protected $method = NULL; |
|
| 34 | 34 | |
| 35 | 35 | /** @var array */ |
| 36 | - protected $body = null; |
|
| 36 | + protected $body = NULL; |
|
| 37 | 37 | |
| 38 | 38 | /** @var \Elasticsearch\Transport */ |
| 39 | - private $transport = null; |
|
| 39 | + private $transport = NULL; |
|
| 40 | 40 | |
| 41 | 41 | /** @var array */ |
| 42 | - private $ignore = null; |
|
| 42 | + private $ignore = NULL; |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | ); |
| 87 | 87 | } catch (\Exception $exception) { |
| 88 | 88 | $code = $exception->getCode(); |
| 89 | - if ($this->ignore === null) { |
|
| 89 | + if ($this->ignore === NULL) { |
|
| 90 | 90 | throw $exception; |
| 91 | - } else if (array_search($code, $this->ignore) === false) { |
|
| 91 | + } else if (array_search($code, $this->ignore) === FALSE) { |
|
| 92 | 92 | throw $exception; |
| 93 | 93 | } else { |
| 94 | 94 | //TODO return null or dedicated object here instead? |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function setParams($params) |
| 110 | 110 | { |
| 111 | - if (is_object($params) === true) { |
|
| 111 | + if (is_object($params) === TRUE) { |
|
| 112 | 112 | $params = (array)$params; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function setIndex($index) |
| 129 | 129 | { |
| 130 | - if ($index === null) { |
|
| 130 | + if ($index === NULL) { |
|
| 131 | 131 | return $this; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if (is_array($index) === true) { |
|
| 134 | + if (is_array($index) === TRUE) { |
|
| 135 | 135 | $index = array_map('trim', $index); |
| 136 | 136 | $index = implode(",", $index); |
| 137 | 137 | } |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function setType($type) |
| 150 | 150 | { |
| 151 | - if ($type === null) { |
|
| 151 | + if ($type === NULL) { |
|
| 152 | 152 | return $this; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (is_array($type) === true) { |
|
| 155 | + if (is_array($type) === TRUE) { |
|
| 156 | 156 | $type = array_map('trim', $type); |
| 157 | 157 | $type = implode(",", $type); |
| 158 | 158 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function setID($docID) |
| 171 | 171 | { |
| 172 | - if ($docID === null) { |
|
| 172 | + if ($docID === NULL) { |
|
| 173 | 173 | return $this; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | private function getOptionalIndex() |
| 211 | 211 | { |
| 212 | - if (isset($this->index) === true){ |
|
| 212 | + if (isset($this->index) === TRUE){ |
|
| 213 | 213 | return $this->index; |
| 214 | 214 | } else { |
| 215 | 215 | return '_all'; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | private function getOptionalType() |
| 224 | 224 | { |
| 225 | - if (isset($this->type) === true){ |
|
| 225 | + if (isset($this->type) === TRUE){ |
|
| 226 | 226 | return $this->type; |
| 227 | 227 | } else { |
| 228 | 228 | return ''; |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | private function ifParamsInvalidThrowException($params) |
| 257 | 257 | { |
| 258 | - if (isset($params) !== true) { |
|
| 258 | + if (isset($params) !== TRUE) { |
|
| 259 | 259 | return; //no params, just return. |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $whitelist = array_merge($this->getParamWhitelist(), array('ignore', 'custom', 'curlOpts')); |
| 263 | 263 | |
| 264 | 264 | foreach ($params as $key => $value) { |
| 265 | - if (array_search($key, $whitelist) === false) { |
|
| 265 | + if (array_search($key, $whitelist) === FALSE) { |
|
| 266 | 266 | throw new UnexpectedValueException(sprintf( |
| 267 | 267 | '"%s" is not a valid parameter. Allowed parameters are: "%s"', |
| 268 | 268 | $key, |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | private function extractIgnore() |
| 278 | 278 | { |
| 279 | - if (isset($this->params['ignore']) === true) { |
|
| 279 | + if (isset($this->params['ignore']) === TRUE) { |
|
| 280 | 280 | $this->ignore = explode(",", $this->params['ignore']); |
| 281 | 281 | unset($this->params['ignore']); |
| 282 | 282 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | private function convertCustom($params) |
| 286 | 286 | { |
| 287 | - if (isset($params['custom']) === true) { |
|
| 287 | + if (isset($params['custom']) === TRUE) { |
|
| 288 | 288 | foreach ($params['custom'] as $k => $v) { |
| 289 | 289 | $params[$k] = $v; |
| 290 | 290 | } |
@@ -297,8 +297,8 @@ discard block |
||
| 297 | 297 | private function convertArraysToStrings($params) |
| 298 | 298 | { |
| 299 | 299 | foreach ($params as &$param) { |
| 300 | - if (is_array($param) === true) { |
|
| 301 | - if ($this->isNestedArray($param) !== true){ |
|
| 300 | + if (is_array($param) === TRUE) { |
|
| 301 | + if ($this->isNestedArray($param) !== TRUE){ |
|
| 302 | 302 | $param = implode(",", $param); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -311,10 +311,10 @@ discard block |
||
| 311 | 311 | private function isNestedArray($a) { |
| 312 | 312 | foreach ($a as $v) { |
| 313 | 313 | if (is_array($v)) { |
| 314 | - return true; |
|
| 314 | + return TRUE; |
|
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | - return false; |
|
| 317 | + return FALSE; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | } |
| 321 | 321 | \ No newline at end of file |