@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $type = $multipartMessage[2]; |
25 | 25 | $message = array_slice($multipartMessage, 3); |
26 | 26 | |
27 | - return [ $id, $type, $message ]; |
|
27 | + return [$id, $type, $message]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $type = $multipartMessage[2]; |
38 | 38 | $message = array_slice($multipartMessage, 3); |
39 | 39 | |
40 | - return [ $id, $type, $message ]; |
|
40 | + return [$id, $type, $message]; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function prepareBinderMessage($id, $type) |
49 | 49 | { |
50 | - return [ $id, $this->id, $type ]; |
|
50 | + return [$id, $this->id, $type]; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,6 +57,6 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected function prepareConnectorMessage($id, $type) |
59 | 59 | { |
60 | - return [ $id, $this->id, $type ]; |
|
60 | + return [$id, $this->id, $type]; |
|
61 | 61 | } |
62 | 62 | } |
@@ -230,7 +230,7 @@ |
||
230 | 230 | public function resetNow() |
231 | 231 | { |
232 | 232 | $this->now = function() { |
233 | - return round(microtime(true)*1000); |
|
233 | + return round(microtime(true) * 1000); |
|
234 | 234 | }; |
235 | 235 | } |
236 | 236 |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | ]; |
165 | 165 | |
166 | 166 | $options = [ |
167 | - 'bufferSize' => isset($params['bufferSize']) ? (int)$params['bufferSize'] : 0, |
|
168 | - 'bufferTimeout' => isset($params['bufferTimeout']) ? (int)$params['bufferTimeout'] : 0, |
|
169 | - 'heartbeatInterval' => isset($params['heartbeatInterval']) ? (int)$params['heartbeatInterval'] : 200, |
|
170 | - 'heartbeatKeepalive' => isset($params['heartbeatKeepalive']) ? (int)$params['heartbeatKeepalive'] : 1000, |
|
171 | - 'timeRegisterInterval' => isset($params['timeRegisterInterval']) ? (int)$params['timeRegisterInterval'] : 400 |
|
167 | + 'bufferSize' => isset($params['bufferSize']) ? (int) $params['bufferSize'] : 0, |
|
168 | + 'bufferTimeout' => isset($params['bufferTimeout']) ? (int) $params['bufferTimeout'] : 0, |
|
169 | + 'heartbeatInterval' => isset($params['heartbeatInterval']) ? (int) $params['heartbeatInterval'] : 200, |
|
170 | + 'heartbeatKeepalive' => isset($params['heartbeatKeepalive']) ? (int) $params['heartbeatKeepalive'] : 1000, |
|
171 | + 'timeRegisterInterval' => isset($params['timeRegisterInterval']) ? (int) $params['timeRegisterInterval'] : 400 |
|
172 | 172 | ]; |
173 | 173 | |
174 | 174 | $this->loop = $loop; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $this->id = $id; |
177 | 177 | $this->endpoint = $endpoint; |
178 | 178 | $this->type = $type; |
179 | - $this->hosts = is_array($hosts) ? $hosts : [ $hosts ]; |
|
179 | + $this->hosts = is_array($hosts) ? $hosts : [$hosts]; |
|
180 | 180 | $this->flags = $flags; |
181 | 181 | $this->options = $options; |
182 | 182 | $this->isConnected = false; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->buffer = $this->getBuffer(); |
190 | 190 | $this->connectionPool = $this->getConnectionPool(); |
191 | 191 | |
192 | - $this->setEventListener('messages', [ $this, 'onMessages' ]); |
|
192 | + $this->setEventListener('messages', [$this, 'onMessages']); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $this->stop(); |
201 | 201 | |
202 | - $this->removeEventListener('messages', [ $this, 'onMessages' ]); |
|
202 | + $this->removeEventListener('messages', [$this, 'onMessages']); |
|
203 | 203 | |
204 | 204 | unset($this->context); |
205 | 205 | unset($this->id); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $connect = $this->connectCallback; |
235 | 235 | if (!$this->socket->$connect($this->endpoint)) |
236 | 236 | { |
237 | - $this->emit('error', [ new ExecutionException('socket not connected.') ]); |
|
237 | + $this->emit('error', [new ExecutionException('socket not connected.')]); |
|
238 | 238 | return false; |
239 | 239 | } |
240 | 240 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | { |
293 | 293 | $status = $this->sendMessage($id, self::COMMAND_MESSAGE, $message, $flags); |
294 | 294 | |
295 | - $this->emit('send', [ $id, (array) $message ]); |
|
295 | + $this->emit('send', [$id, (array) $message]); |
|
296 | 296 | |
297 | 297 | return $status; |
298 | 298 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | foreach ($conns as $conn) |
315 | 315 | { |
316 | - $this->emit('send', [ $conn, (array) $message ]); |
|
316 | + $this->emit('send', [$conn, (array) $message]); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | return $statuses; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | */ |
551 | 551 | private function recvMessage(Connection $conn, $message) |
552 | 552 | { |
553 | - $this->emit('recv', [ $conn->id, $message ]); |
|
553 | + $this->emit('recv', [$conn->id, $message]); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | |
566 | 566 | if ($this->connectionPool->setConnection($conn->id)) |
567 | 567 | { |
568 | - $this->emit('connect', [ $conn->getId() ]); |
|
568 | + $this->emit('connect', [$conn->getId()]); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | if ($this->type === self::BINDER) |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | if ($this->hTimer === null && $this->flags['enableHeartbeat']) |
605 | 605 | { |
606 | 606 | $proxy = $this; |
607 | - $this->hTimer = $this->loop->addPeriodicTimer(($this->options['heartbeatInterval']/1000), function() use($proxy) { |
|
607 | + $this->hTimer = $this->loop->addPeriodicTimer(($this->options['heartbeatInterval'] / 1000), function() use($proxy) { |
|
608 | 608 | |
609 | 609 | if ($proxy->type === self::CONNECTOR) |
610 | 610 | { |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | foreach ($deleted as $deletedid) |
630 | 630 | { |
631 | - $this->emit('disconnect', [ $deletedid ]); |
|
631 | + $this->emit('disconnect', [$deletedid]); |
|
632 | 632 | } |
633 | 633 | } |
634 | 634 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | } |
674 | 674 | else if (!is_array($message)) |
675 | 675 | { |
676 | - $message = [ $message ]; |
|
676 | + $message = [$message]; |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | $frame = array_merge($frame, $message); |
@@ -734,8 +734,8 @@ discard block |
||
734 | 734 | if ($this->rTimer === null && $this->flags['enableHeartbeat'] === true && $this->flags['enableTimeRegister'] === true) |
735 | 735 | { |
736 | 736 | $proxy = $this; |
737 | - $this->rTimer = $this->loop->addPeriodicTimer(($this->options['timeRegisterInterval']/1000), function() use($proxy) { |
|
738 | - $now = round(microtime(true)*1000); |
|
737 | + $this->rTimer = $this->loop->addPeriodicTimer(($this->options['timeRegisterInterval'] / 1000), function() use($proxy) { |
|
738 | + $now = round(microtime(true) * 1000); |
|
739 | 739 | $proxy->connectionPool->setNow(function() use($now) { |
740 | 740 | return $now; |
741 | 741 | }); |