@@ -50,7 +50,7 @@ |
||
50 | 50 | return new NVServer( |
51 | 51 | $serviced, |
52 | 52 | $listen, |
53 | - (new Events)->attach(Events\HTTP::REQUESTING, function (Connection $conn) use ($processor) { |
|
53 | + (new Events)->attach(Events\HTTP::REQUESTING, function(Connection $conn) use ($processor) { |
|
54 | 54 | try { |
55 | 55 | $processor($conn); |
56 | 56 | } catch (Throwable $e) { |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | public function perform(Request $request, Promised $canceller = null) : Promised |
90 | 90 | { |
91 | 91 | if ($this->options->pooled()) { |
92 | - return async(function () use ($request, $canceller) { |
|
92 | + return async(function() use ($request, $canceller) { |
|
93 | 93 | if ($canceller) { |
94 | 94 | $interrupt = Promise::deferred(); |
95 | - $canceller->then(static function () use ($interrupt) { |
|
96 | - $interrupt->then(static function (SWClient $client) { |
|
95 | + $canceller->then(static function() use ($interrupt) { |
|
96 | + $interrupt->then(static function(SWClient $client) { |
|
97 | 97 | return $client->close(); |
98 | 98 | }); |
99 | 99 | $interrupt->resolve(); |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | }); |
110 | 110 | } |
111 | 111 | |
112 | - return async(function () use ($request, $canceller) { |
|
112 | + return async(function() use ($request, $canceller) { |
|
113 | 113 | /** |
114 | 114 | * @var SWClient $client |
115 | 115 | */ |
116 | 116 | $this->session = $client = yield $this->http($this->remote($request->getUri()), false); |
117 | 117 | |
118 | - $canceller && $canceller->then(static function () use ($client) { |
|
118 | + $canceller && $canceller->then(static function() use ($client) { |
|
119 | 119 | return $client->close(); |
120 | 120 | }); |
121 | 121 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function keepalived(Closure $initialize) : void |
156 | 156 | { |
157 | - ($this->ka ?? $this->ka = Promise::deferred())->then(function () use ($initialize) { |
|
157 | + ($this->ka ?? $this->ka = Promise::deferred())->then(function() use ($initialize) { |
|
158 | 158 | $initialize($this->pool); |
159 | 159 | }); |
160 | 160 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | return $this->pool; |
170 | 170 | } |
171 | 171 | |
172 | - $this->pool = new Pool($this->options->pooling(), function () use ($remote) { |
|
172 | + $this->pool = new Pool($this->options->pooling(), function() use ($remote) { |
|
173 | 173 | return $this->http($remote, true); |
174 | 174 | }, $this->options->identify()); |
175 | 175 | |
176 | - $this->pool->closed()->then(function () { |
|
176 | + $this->pool->closed()->then(function() { |
|
177 | 177 | $this->pool = null; |
178 | 178 | }); |
179 | 179 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function serve() : void |
85 | 85 | { |
86 | - swoole_event_add($this->listener, function ($server) { |
|
86 | + swoole_event_add($this->listener, function($server) { |
|
87 | 87 | $this->incoming($server); |
88 | 88 | }); |
89 | 89 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | private function incoming($server) : void |
135 | 135 | { |
136 | 136 | $idx = $this->idx += 1; |
137 | - swoole_event_add($this->fds[$idx] = stream_socket_accept($server), function () use ($idx) { |
|
137 | + swoole_event_add($this->fds[$idx] = stream_socket_accept($server), function() use ($idx) { |
|
138 | 138 | $this->receiving($idx); |
139 | 139 | }); |
140 | 140 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $this->http->set($pxc); |
91 | 91 | } |
92 | 92 | |
93 | - $this->http->on('connect', function () { |
|
93 | + $this->http->on('connect', function() { |
|
94 | 94 | $this->http->on('error', [$this, 'failure']); |
95 | 95 | $this->http->on('close', [$this, 'closing']); |
96 | 96 | }); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function hasProxy() : bool |
24 | 24 | { |
25 | - return ! empty($this->proxy); |
|
25 | + return !empty($this->proxy); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -48,8 +48,8 @@ |
||
48 | 48 | new Address($host, $port) |
49 | 49 | ); |
50 | 50 | |
51 | - $cli->keepalived(static function (Pool $pool) use ($pk) { |
|
52 | - $pool->closed()->then(function () use ($pk) { |
|
51 | + $cli->keepalived(static function(Pool $pool) use ($pk) { |
|
52 | + $pool->closed()->then(function() use ($pk) { |
|
53 | 53 | unset(self::$keeps[$pk]); |
54 | 54 | }); |
55 | 55 | }); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | // -- message event |
90 | 90 | |
91 | - $http->on('message', static function (SWHClient $c, SWSFrame $f) use ($framing, $socket) { |
|
91 | + $http->on('message', static function(SWHClient $c, SWSFrame $f) use ($framing, $socket) { |
|
92 | 92 | switch ($f->opcode) { |
93 | 93 | case WSOpcode::CLOSING: |
94 | 94 | $socket->status(false); |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | } |
100 | 100 | }); |
101 | 101 | |
102 | - $http->on('close', static function (SWHClient $c) use ($framing, $socket) { |
|
102 | + $http->on('close', static function(SWHClient $c) use ($framing, $socket) { |
|
103 | 103 | $socket->status(false); |
104 | 104 | $framing->message()->close(); |
105 | 105 | }); |
106 | 106 | |
107 | 107 | // -- socket dial |
108 | 108 | |
109 | - $connector = function ($fn) use ($http, $request) { |
|
109 | + $connector = function($fn) use ($http, $request) { |
|
110 | 110 | $http->upgrade($this->getUriPath($request->getUri()), $fn); |
111 | 111 | }; |
112 | 112 | |
113 | 113 | // -- socket resp |
114 | 114 | |
115 | - $response = function (SWHClient $c) use ($request, $framing, $socket) { |
|
115 | + $response = function(SWHClient $c) use ($request, $framing, $socket) { |
|
116 | 116 | $code = $c->statusCode; |
117 | 117 | |
118 | 118 | if ($code === 101) { |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $this->socket->write(implode(Protocol::CRLF, $lines).Protocol::SPLIT); |
52 | 52 | |
53 | 53 | if ($response->getBody()->getSize() > 0) { |
54 | - $this->socket->write((string)$response->getBody()); |
|
54 | + $this->socket->write((string) $response->getBody()); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // -- net sender |
35 | 35 | |
36 | - $executor = function ($fn) use ($http, $request) { |
|
36 | + $executor = function($fn) use ($http, $request) { |
|
37 | 37 | $uri = $this->getUriPath($request->getUri()); |
38 | 38 | |
39 | 39 | $stream = $request->getBody(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | if ($stream->getSize() > 0) { |
50 | - $http->setData((string)$stream); |
|
50 | + $http->setData((string) $stream); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $http->execute($uri, $fn); |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | |
56 | 56 | // -- net receiver |
57 | 57 | |
58 | - $receiver = function (SWHClient $c) use ($request) { |
|
58 | + $receiver = function(SWHClient $c) use ($request) { |
|
59 | 59 | $code = $c->statusCode; |
60 | - $headers = (array)$c->headers; |
|
60 | + $headers = (array) $c->headers; |
|
61 | 61 | $response = $c->body; |
62 | 62 | |
63 | 63 | // reset cli headers !! |