@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | * @param array $params |
| 29 | 29 | * @return Response |
| 30 | 30 | */ |
| 31 | - public function execute(Request $request, $params=[]) |
|
| 31 | + public function execute(Request $request, $params = []) |
|
| 32 | 32 | { |
| 33 | 33 | $connection = $this->getConnection(); |
| 34 | 34 | $conn = $this->_getCurlConnection($connection->getConfig('persistent')); |
| 35 | - $url = $this->_scheme.'://'.$connection->getHost().':'.$connection->getPort(); |
|
| 35 | + $url = $this->_scheme . '://' . $connection->getHost() . ':' . $connection->getPort(); |
|
| 36 | 36 | $endpoint = $request->getPath(); |
| 37 | 37 | $url .= $endpoint; |
| 38 | 38 | $url = $this->setupURI($url, $request->getQuery()); |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | curl_setopt($conn, CURLOPT_CUSTOMREQUEST, $method); |
| 59 | 59 | curl_setopt($conn, CURLOPT_HTTPHEADER, $headers); |
| 60 | 60 | |
| 61 | - if ($connection->getConnectTimeout()>0) { |
|
| 61 | + if ($connection->getConnectTimeout() > 0) { |
|
| 62 | 62 | curl_setopt($conn, CURLOPT_CONNECTTIMEOUT, $connection->getConnectTimeout()); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if ($connection->getConfig('username') !== null && $connection->getConfig('password') !== null) { |
| 66 | 66 | curl_setopt($conn, CURLOPT_HTTPAUTH, CURLAUTH_ANY); |
| 67 | - curl_setopt($conn, CURLOPT_USERPWD, $connection->getConfig('username').":".$connection->getConfig('password')); |
|
| 67 | + curl_setopt($conn, CURLOPT_USERPWD, $connection->getConfig('username') . ":" . $connection->getConfig('password')); |
|
| 68 | 68 | } |
| 69 | 69 | if ($connection->getConfig('proxy') !== null) { |
| 70 | 70 | curl_setopt($conn, CURLOPT_PROXY, $connection->getConfig('proxy')); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'body' => $request->getBody() |
| 97 | 97 | ]); |
| 98 | 98 | //hard error |
| 99 | - if ($errorno>0) { |
|
| 99 | + if ($errorno > 0) { |
|
| 100 | 100 | $error = curl_error($conn); |
| 101 | 101 | |
| 102 | 102 | /* @phpstan-ignore-next-line */ |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param bool $persistent |
| 131 | 131 | * @return false|resource |
| 132 | 132 | */ |
| 133 | - protected function _getCurlConnection(bool $persistent=true) |
|
| 133 | + protected function _getCurlConnection(bool $persistent = true) |
|
| 134 | 134 | { |
| 135 | 135 | if (!$persistent || !self::$_curl) { |
| 136 | 136 | self::$_curl = curl_init(); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function setBody($params = null) |
| 16 | 16 | { |
| 17 | 17 | if (isset($this->_index)) { |
| 18 | - $binds =[]; |
|
| 18 | + $binds = []; |
|
| 19 | 19 | $binds[] = "'" . self::escape($params['query']) . "'"; |
| 20 | 20 | $binds[] = "'" . $this->_index . "'"; |
| 21 | 21 | if (count($params['options']) > 0) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $binds[] = "$value AS $name"; |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | - return parent::setBody( ['query' => "CALL KEYWORDS(" . implode(",", $binds) . ")"]); |
|
| 26 | + return parent::setBody(['query' => "CALL KEYWORDS(" . implode(",", $binds) . ")"]); |
|
| 27 | 27 | } |
| 28 | 28 | throw new RuntimeException('Index name is missing.'); |
| 29 | 29 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | public function setBody($params = null) |
| 15 | 15 | { |
| 16 | 16 | if (isset($this->_index)) { |
| 17 | - $binds =[]; |
|
| 17 | + $binds = []; |
|
| 18 | 18 | $binds[] = "'" . self::escape($params['query']) . "'"; |
| 19 | 19 | $binds[] = "'" . $this->_index . "'"; |
| 20 | 20 | if (count($params['options']) > 0) { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $binds[] = "$value AS $name"; |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | - return parent::setBody( ['query' => "CALL SUGGEST(" . implode(",", $binds) . ")"]); |
|
| 25 | + return parent::setBody(['query' => "CALL SUGGEST(" . implode(",", $binds) . ")"]); |
|
| 26 | 26 | } |
| 27 | 27 | throw new RuntimeException('Index name is missing.'); |
| 28 | 28 | } |