@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | $response = $this->send(new StartControlChannelCommand()); |
23 | 23 | |
24 | - if($bufferSize = $response->get('bufferSize')){ |
|
24 | + if ($bufferSize = $response->get('bufferSize')) { |
|
25 | 25 | $this->bufferSize = (int) $bufferSize; |
26 | 26 | } |
27 | 27 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $this->client->connect(); |
30 | 30 | $response = $this->client->read(); |
31 | - if($response->getStatus() == "CONNECTED") { |
|
31 | + if ($response->getStatus() == "CONNECTED") { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | throw new ConnectionException; |
@@ -63,4 +63,4 @@ |
||
63 | 63 | return $this->get('count') ?? 0; |
64 | 64 | } |
65 | 65 | } |
66 | - |
|
67 | 66 | \ No newline at end of file |
67 | + |
|
68 | 68 | \ No newline at end of file |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | { |
28 | 28 | $this->pieces = explode(" ", $this->message); |
29 | 29 | |
30 | - if(preg_match_all("/buffer\((\d+)\)/", $this->message, $matches)) { |
|
30 | + if (preg_match_all("/buffer\((\d+)\)/", $this->message, $matches)) { |
|
31 | 31 | $this->pieces['bufferSize'] = $matches[1][0]; |
32 | 32 | } |
33 | 33 | |
34 | 34 | $this->pieces['status'] = $this->pieces[0]; |
35 | 35 | unset($this->pieces[0]); |
36 | 36 | |
37 | - if($this->pieces['status'] === 'RESULT') { |
|
37 | + if ($this->pieces['status'] === 'RESULT') { |
|
38 | 38 | $this->pieces['count'] = (int) $this->pieces[1]; |
39 | 39 | unset($this->pieces[1]); |
40 | 40 | } |
41 | 41 | |
42 | - if($this->pieces['status'] === 'EVENT') { |
|
42 | + if ($this->pieces['status'] === 'EVENT') { |
|
43 | 43 | $this->pieces['query_key'] = $this->pieces[2]; |
44 | - $this->results = array_slice($this->pieces, 2, count($this->pieces)-4); |
|
44 | + $this->results = array_slice($this->pieces, 2, count($this->pieces) - 4); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function get($key) |
69 | 69 | { |
70 | - if(isset($this->pieces[$key])){ |
|
70 | + if (isset($this->pieces[$key])) { |
|
71 | 71 | return $this->pieces[$key]; |
72 | 72 | } |
73 | 73 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -if(! function_exists('quote')) { |
|
7 | +if (!function_exists('quote')) { |
|
8 | 8 | /** |
9 | 9 | * append and prepend a string with double quotes |
10 | 10 | * @param string $string |
@@ -9,5 +9,5 @@ |
||
9 | 9 | * @return string |
10 | 10 | * ultimately a command instance get translated into a string |
11 | 11 | */ |
12 | - public function __toString(): string ; |
|
12 | + public function __toString(): string; |
|
13 | 13 | } |
14 | 14 | \ No newline at end of file |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $response = $this->send(new StartIngestChannelCommand); |
36 | 36 | |
37 | - if($bufferSize = $response->get('bufferSize')){ |
|
37 | + if ($bufferSize = $response->get('bufferSize')) { |
|
38 | 38 | $this->bufferSize = (int) $bufferSize; |
39 | 39 | } |
40 | 40 | |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function push(string $collection, string $bucket, string $object, string $text) |
52 | 52 | { |
53 | - $chunks = $this->splitString($collection,$bucket, $object, $text); |
|
53 | + $chunks = $this->splitString($collection, $bucket, $object, $text); |
|
54 | 54 | |
55 | - if($text == "" || empty($chunks)) { |
|
55 | + if ($text == "" || empty($chunks)) { |
|
56 | 56 | throw new InvalidArgumentException("The parameter \$text is empty"); |
57 | 57 | } |
58 | 58 | foreach ($chunks as $chunk) { |
59 | 59 | $message = $this->send(new PushCommand($collection, $bucket, $object, $chunk)); |
60 | - if($message == false || $message == "") { |
|
60 | + if ($message == false || $message == "") { |
|
61 | 61 | throw new InvalidArgumentException(); |
62 | 62 | } |
63 | 63 | } |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function pop(string $collection, string $bucket, string $object, string $text) |
75 | 75 | { |
76 | - $chunks = $this->splitString($collection,$bucket, $object, $text); |
|
76 | + $chunks = $this->splitString($collection, $bucket, $object, $text); |
|
77 | 77 | $count = 0; |
78 | 78 | foreach ($chunks as $chunk) { |
79 | 79 | $message = $this->send(new PopCommand($collection, $bucket, $object, $chunk)); |
80 | - if($message == false || $message == "") { |
|
80 | + if ($message == false || $message == "") { |
|
81 | 81 | throw new InvalidArgumentException(); |
82 | 82 | } |
83 | 83 | $count += $message->get('count'); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | 'collection' => $collection, |
23 | 23 | 'bucket' => $bucket, |
24 | 24 | 'terms' => quote($terms), |
25 | - 'limit' => $limit ? "LIMIT($limit)": null, |
|
25 | + 'limit' => $limit ? "LIMIT($limit)" : null, |
|
26 | 26 | ]; |
27 | 27 | |
28 | 28 | parent::__construct($this->command, $this->parameters); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | $response = $this->send(new StartSearchChannelCommand()); |
33 | 33 | |
34 | - if($bufferSize = $response->get('bufferSize')){ |
|
34 | + if ($bufferSize = $response->get('bufferSize')) { |
|
35 | 35 | $this->bufferSize = (int) $bufferSize; |
36 | 36 | } |
37 | 37 | |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | { |
51 | 51 | $response = $this->send(new QueryCommand($collection, $bucket, $terms, $limit)); |
52 | 52 | |
53 | - if(! $response->getStatus() == 'PENDING') { |
|
53 | + if (!$response->getStatus() == 'PENDING') { |
|
54 | 54 | throw new CommandFailedException; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $results = $this->read(); |
58 | 58 | |
59 | - if(! $results->getStatus() == 'EVENT') { |
|
59 | + if (!$results->getStatus() == 'EVENT') { |
|
60 | 60 | throw new CommandFailedException; |
61 | 61 | } |
62 | 62 | |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | * @return array |
72 | 72 | * @throws CommandFailedException |
73 | 73 | */ |
74 | - public function suggest($collection, $bucket, $terms, $limit=null): array |
|
74 | + public function suggest($collection, $bucket, $terms, $limit = null): array |
|
75 | 75 | { |
76 | 76 | $response = $this->send(new SuggestCommand($collection, $bucket, $terms, $limit)); |
77 | 77 | |
78 | - if(! $response->getStatus() == 'PENDING') { |
|
78 | + if (!$response->getStatus() == 'PENDING') { |
|
79 | 79 | throw new CommandFailedException; |
80 | 80 | } |
81 | 81 | |
82 | 82 | $results = $this->read(); |
83 | 83 | |
84 | - if(! $results->getStatus() == 'EVENT') { |
|
84 | + if (!$results->getStatus() == 'EVENT') { |
|
85 | 85 | throw new CommandFailedException; |
86 | 86 | } |
87 | 87 |