@@ -7,19 +7,19 @@ |
||
7 | 7 | $loop = React\EventLoop\Factory::create(); |
8 | 8 | $client = Factory::createClient($loop); |
9 | 9 | |
10 | -$client->set('name', ['test'])->then(function($result){ |
|
10 | +$client->set('name', ['test'])->then(function($result) { |
|
11 | 11 | var_dump($result); |
12 | 12 | echo "The value was added\n"; |
13 | 13 | }); |
14 | -$client->get('name')->then(function($data){ |
|
14 | +$client->get('name')->then(function($data) { |
|
15 | 15 | var_dump($data); |
16 | 16 | echo "The value was retrieved\n"; |
17 | 17 | }); |
18 | -$client->replace('name', 'new')->then(function($data){ |
|
18 | +$client->replace('name', 'new')->then(function($data) { |
|
19 | 19 | var_dump($data); |
20 | 20 | echo "The value was replaced\n"; |
21 | 21 | }); |
22 | -$client->get('name')->then(function($data){ |
|
22 | +$client->get('name')->then(function($data) { |
|
23 | 23 | var_dump($data); |
24 | 24 | echo "The value was retrieved\n"; |
25 | 25 | }); |
@@ -7,16 +7,16 @@ |
||
7 | 7 | $loop = React\EventLoop\Factory::create(); |
8 | 8 | $client = Factory::createClient($loop); |
9 | 9 | |
10 | -$client->set('name', 'test')->then(function(){ |
|
10 | +$client->set('name', 'test')->then(function() { |
|
11 | 11 | echo "The value was stored\n"; |
12 | -}, function(Exception $e){ |
|
12 | +}, function(Exception $e) { |
|
13 | 13 | echo 'set: ', $e->getMessage(), "\n"; |
14 | 14 | }); |
15 | 15 | $client->close(); |
16 | -$client->get('name')->then(function($data){ |
|
16 | +$client->get('name')->then(function($data) { |
|
17 | 17 | var_dump($data); |
18 | 18 | echo "The value was retrieved\n"; |
19 | -}, function(Exception $e){ |
|
19 | +}, function(Exception $e) { |
|
20 | 20 | echo 'get: ', $e->getMessage(), "\n"; |
21 | 21 | }); |
22 | 22 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $result = ''; |
115 | 115 | } |
116 | 116 | |
117 | - if(strpos($line, self::RESPONSE_VERSION) !== false) { |
|
117 | + if (strpos($line, self::RESPONSE_VERSION) !== false) { |
|
118 | 118 | $results[] = $line; |
119 | 119 | $result = ''; |
120 | 120 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $result .= self::COMMAND_SEPARATOR; |
123 | 123 | } |
124 | 124 | |
125 | - if(!empty($result) && $result !== self::COMMAND_SEPARATOR) { |
|
125 | + if (!empty($result) && $result !== self::COMMAND_SEPARATOR) { |
|
126 | 126 | $results[] = $result; |
127 | 127 | } |
128 | 128 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function createResponse($command, $data) |
160 | 160 | { |
161 | - switch($command) { |
|
161 | + switch ($command) { |
|
162 | 162 | case self::COMMAND_GET: |
163 | 163 | return new ReadResponse($data); |
164 | 164 | case self::COMMAND_SET: |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function createRequest($command, $args) |
192 | 192 | { |
193 | - if(!in_array($command, self::COMMANDS)) { |
|
193 | + if (!in_array($command, self::COMMANDS)) { |
|
194 | 194 | throw new WrongCommandException("Unknown command: $command"); |
195 | 195 | } |
196 | 196 | |
197 | - if(in_array($command, self::STORAGE_COMMANDS)) { |
|
197 | + if (in_array($command, self::STORAGE_COMMANDS)) { |
|
198 | 198 | return new StorageRequest($command, ...$args); |
199 | 199 | } |
200 | 200 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function parse() |
15 | 15 | { |
16 | - if(trim($this->data) !== Parser::RESPONSE_DELETED) { |
|
16 | + if (trim($this->data) !== Parser::RESPONSE_DELETED) { |
|
17 | 17 | $this->fail(); |
18 | 18 | } |
19 | 19 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function parse() |
13 | 13 | { |
14 | - if(trim($this->data) !== Parser::RESPONSE_OK) { |
|
14 | + if (trim($this->data) !== Parser::RESPONSE_OK) { |
|
15 | 15 | $this->fail(); |
16 | 16 | } |
17 | 17 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | foreach ($lines as $line) { |
18 | 18 | preg_match('/STAT (\w+) (\w+)/', $line, $matches); |
19 | - if(empty($matches)) { |
|
19 | + if (empty($matches)) { |
|
20 | 20 | break; |
21 | 21 | } |
22 | 22 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function parse() |
15 | 15 | { |
16 | - if(trim($this->data) !== Parser::RESPONSE_TOUCHED) { |
|
16 | + if (trim($this->data) !== Parser::RESPONSE_TOUCHED) { |
|
17 | 17 | $this->fail(); |
18 | 18 | } |
19 | 19 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | $value = isset($match[1]) ? trim($match[1]) : null; |
18 | 18 | |
19 | - if(null === $value) { |
|
19 | + if (null === $value) { |
|
20 | 20 | $this->fail(); |
21 | 21 | } |
22 | 22 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function parse() |
15 | 15 | { |
16 | - if($this->data === Parser::RESPONSE_NOT_FOUND) { |
|
16 | + if ($this->data === Parser::RESPONSE_NOT_FOUND) { |
|
17 | 17 | $this->fail(); |
18 | 18 | } |
19 | 19 |