@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public $retries; |
27 | 27 | |
28 | - public $retries_attempts =0; |
|
28 | + public $retries_attempts = 0; |
|
29 | 29 | |
30 | 30 | public function __construct(array $connections, SelectorInterface $strategy, int $retries) |
31 | 31 | { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function getConnection(): Connection |
53 | 53 | { |
54 | 54 | $this->retries_attempts++; |
55 | - $connection = $this->strategy->getConnection($this->connections); |
|
55 | + $connection = $this->strategy->getConnection($this->connections); |
|
56 | 56 | if ($connection->isAlive()) { |
57 | 57 | return $connection; |
58 | 58 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | public function __construct($params = []) |
34 | 34 | { |
35 | - if (count($params)>0) { |
|
35 | + if (count($params) > 0) { |
|
36 | 36 | $this->setBody($params['body'] ?? []); |
37 | 37 | $this->setQuery($params['query'] ?? []); |
38 | 38 | $this->setContentType($params['content_type'] ?? 'application/json'); |
@@ -14,8 +14,8 @@ |
||
14 | 14 | |
15 | 15 | public function getDocsMatched($docs) |
16 | 16 | { |
17 | - return array_map(function ($v) use ($docs) { |
|
18 | - return $docs[$v - 1]; |
|
17 | + return array_map(function($v) use ($docs) { |
|
18 | + return $docs[$v-1]; |
|
19 | 19 | }, $this->data['fields']['_percolator_document_slot']); |
20 | 20 | } |
21 | 21 | } |
@@ -31,6 +31,6 @@ |
||
31 | 31 | |
32 | 32 | public function hasQueries() |
33 | 33 | { |
34 | - return count($this->doc['queries'])>0; |
|
34 | + return count($this->doc['queries']) > 0; |
|
35 | 35 | } |
36 | 36 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | if (isset($query['fields'], $query['fields']['_percolator_document_slot'])) { |
41 | 41 | foreach ($query['fields']['_percolator_document_slot'] as $d) { |
42 | 42 | if (isset($this->array[$d-1])) { |
43 | - $this->array[$d-1]['queries'][] =$query; |
|
43 | + $this->array[$d-1]['queries'][] = $query; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -24,17 +24,17 @@ |
||
24 | 24 | { |
25 | 25 | if (isset($this->cluster)) { |
26 | 26 | if (isset($params['node'])) { |
27 | - return parent::setBody(['query' => "JOIN CLUSTER ".$this->cluster." AT '".$params['node']."'"]); |
|
27 | + return parent::setBody(['query' => "JOIN CLUSTER " . $this->cluster . " AT '" . $params['node'] . "'"]); |
|
28 | 28 | } else { |
29 | - $options =[]; |
|
29 | + $options = []; |
|
30 | 30 | if (isset($params['path'])) { |
31 | - $options[] = "'".$params['path']. "' AS path"; |
|
31 | + $options[] = "'" . $params['path'] . "' AS path"; |
|
32 | 32 | } |
33 | 33 | if (isset($params['nodes'])) { |
34 | - $options[] = "'".$params['nodes']. "' AS nodes"; |
|
34 | + $options[] = "'" . $params['nodes'] . "' AS nodes"; |
|
35 | 35 | } |
36 | - return parent::setBody(['query' => "JOIN CLUSTER ".$this->cluster. |
|
37 | - ((count($options)>0)?" ".implode(',', $options):"")]); |
|
36 | + return parent::setBody(['query' => "JOIN CLUSTER " . $this->cluster . |
|
37 | + ((count($options) > 0) ? " " . implode(',', $options) : "")]); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | throw new RuntimeException('Cluster name is missing.'); |
@@ -9,6 +9,6 @@ |
||
9 | 9 | { |
10 | 10 | public function __construct($keywords, $fields) |
11 | 11 | { |
12 | - $this->params['match'] =[$fields => $keywords]; |
|
12 | + $this->params['match'] = [$fields => $keywords]; |
|
13 | 13 | } |
14 | 14 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | |
78 | 78 | if (isset($params['responseClass'])) { |
79 | 79 | $responseClass = $params['responseClass']; |
80 | - $responseClassParams = isset($params['responseClassParams'])?$params['responseClassParams']:[]; |
|
80 | + $responseClassParams = isset($params['responseClassParams']) ? $params['responseClassParams'] : []; |
|
81 | 81 | $response = new $responseClass($responseString, $status, $responseClassParams); |
82 | 82 | } else { |
83 | 83 | $response = new Response($responseString, $status); |
@@ -7,8 +7,8 @@ |
||
7 | 7 | { |
8 | 8 | public static function escape($string): string |
9 | 9 | { |
10 | - $from = ['\\', '(',')','|','-','!','@','~','"','&', '/', '^', '$', '=', '<']; |
|
11 | - $to = ['\\\\', '\(','\)','\|','\-','\!','\@','\~','\"', '\&', '\/', '\^', '\$', '\=', '\<']; |
|
10 | + $from = ['\\', '(', ')', '|', '-', '!', '@', '~', '"', '&', '/', '^', '$', '=', '<']; |
|
11 | + $to = ['\\\\', '\(', '\)', '\|', '\-', '\!', '\@', '\~', '\"', '\&', '\/', '\^', '\$', '\=', '\<']; |
|
12 | 12 | return str_replace($from, $to, $string); |
13 | 13 | } |
14 | 14 | } |