Completed
Push — master ( bc0a3c...7ffb1b )
by y
01:16
created
src/Reactor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
      * @return int
32 32
      * @throws SocketError
33 33
      */
34
-    public static function select (array &$read, array &$write, array &$except, ?float $timeout = null): int {
34
+    public static function select(array &$read, array &$write, array &$except, ?float $timeout = null): int {
35 35
         $rwe = [$read, $write, $except];
36 36
         array_walk_recursive($rwe, function(SocketInterface &$each) {
37 37
             $each = $each->getResource();
38 38
         });
39
-        $uSec = (int)(fmod($timeout, 1) * 1000000); // ignored if timeout is null
39
+        $uSec = (int) (fmod($timeout, 1) * 1000000); // ignored if timeout is null
40 40
         $count = @socket_select($rwe[0], $rwe[1], $rwe[2], $timeout, $uSec); // keys are preserved
41 41
         if ($count === false) {
42 42
             $read = $write = $except = [];
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @param ReactiveInterface $socket
55 55
      * @return $this
56 56
      */
57
-    public function add (ReactiveInterface $socket) {
57
+    public function add(ReactiveInterface $socket) {
58 58
         $this->sockets[$socket->getId()] = $socket;
59 59
         return $this;
60 60
     }
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return int
66 66
      */
67
-    public function count (): int {
67
+    public function count(): int {
68 68
         return count($this->sockets);
69 69
     }
70 70
 
71 71
     /**
72 72
      * @return ReactiveInterface[]
73 73
      */
74
-    public function getSockets () {
74
+    public function getSockets() {
75 75
         return $this->sockets;
76 76
     }
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param ReactiveInterface $socket
82 82
      * @return bool
83 83
      */
84
-    public function has (ReactiveInterface $socket): bool {
84
+    public function has(ReactiveInterface $socket): bool {
85 85
         return isset($sockets[$socket->getId()]);
86 86
     }
87 87
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      * @param ReactiveInterface $socket
91 91
      * @param Throwable $error
92 92
      */
93
-    protected function onError (int $channel, $socket, Throwable $error): void {
93
+    protected function onError(int $channel, $socket, Throwable $error): void {
94 94
         unset($channel);
95 95
         if ($socket instanceof WebSocketClient and $error instanceof WebSocketError) {
96 96
             if ($socket->isOpen()) {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param float|null $timeout Maximum seconds to block. `NULL` blocks forever.
115 115
      * @return int Number of sockets selected.
116 116
      */
117
-    public function react (?float $timeout = null): int {
117
+    public function react(?float $timeout = null): int {
118 118
         /** @var ReactiveInterface[][] $rwe */
119 119
         $rwe = [$this->sockets, [], $this->sockets];
120 120
         $count = static::select($rwe[0], $rwe[1], $rwe[2], $timeout);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * @param ReactiveInterface $socket
144 144
      * @return $this
145 145
      */
146
-    public function remove (ReactiveInterface $socket) {
146
+    public function remove(ReactiveInterface $socket) {
147 147
         unset($this->sockets[$socket->getId()]);
148 148
         return $this;
149 149
     }
Please login to merge, or discard this patch.