@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | $this->context = $context; |
| 143 | 143 | |
| 144 | 144 | $that = $this; |
| 145 | - $this->tcp->on('connection', function ($connection) use ($that) { |
|
| 145 | + $this->tcp->on('connection', function($connection) use ($that) { |
|
| 146 | 146 | $that->handleConnection($connection); |
| 147 | 147 | }); |
| 148 | - $this->tcp->on('error', function ($error) use ($that) { |
|
| 148 | + $this->tcp->on('error', function($error) use ($that) { |
|
| 149 | 149 | $that->emit('error', array($error)); |
| 150 | 150 | }); |
| 151 | 151 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | return null; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - return \str_replace('tcp://' , 'tls://', $address); |
|
| 160 | + return \str_replace('tcp://', 'tls://', $address); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function pause() |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | $that = $this; |
| 194 | 194 | |
| 195 | 195 | $this->encryption->enable($connection)->then( |
| 196 | - function ($conn) use ($that) { |
|
| 196 | + function($conn) use ($that) { |
|
| 197 | 197 | $that->emit('connection', array($conn)); |
| 198 | 198 | }, |
| 199 | - function ($error) use ($that, $connection, $remote) { |
|
| 199 | + function($error) use ($that, $connection, $remote) { |
|
| 200 | 200 | $error = new \RuntimeException( |
| 201 | 201 | 'Connection from ' . $remote . ' failed during TLS handshake: ' . $error->getMessage(), |
| 202 | 202 | $error->getCode() |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->loop = $loop ?: Loop::get(); |
| 138 | 138 | |
| 139 | 139 | // a single port has been given => assume localhost |
| 140 | - if ((string)(int)$uri === (string)$uri) { |
|
| 140 | + if ((string) (int) $uri === (string) $uri) { |
|
| 141 | 141 | $uri = '127.0.0.1:' . $uri; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | $that = $this; |
| 232 | - $this->loop->addReadStream($this->master, function ($master) use ($that) { |
|
| 232 | + $this->loop->addReadStream($this->master, function($master) use ($that) { |
|
| 233 | 233 | try { |
| 234 | 234 | $newSocket = SocketServer::accept($master); |
| 235 | 235 | } catch (\RuntimeException $e) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // TODO: add write() event to make sure we're not sending any excessive data |
| 67 | 67 | |
| 68 | 68 | // cancelling this leaves this stream in an inconsistent state… |
| 69 | - $deferred = new Deferred(function () { |
|
| 69 | + $deferred = new Deferred(function() { |
|
| 70 | 70 | throw new \RuntimeException(); |
| 71 | 71 | }); |
| 72 | 72 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $that = $this; |
| 84 | - $toggleCrypto = function () use ($socket, $deferred, $toggle, $method, $that) { |
|
| 84 | + $toggleCrypto = function() use ($socket, $deferred, $toggle, $method, $that) { |
|
| 85 | 85 | $that->toggleCrypto($socket, $deferred, $toggle, $method); |
| 86 | 86 | }; |
| 87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $loop = $this->loop; |
| 95 | 95 | |
| 96 | - return $deferred->promise()->then(function () use ($stream, $socket, $loop, $toggle) { |
|
| 96 | + return $deferred->promise()->then(function() use ($stream, $socket, $loop, $toggle) { |
|
| 97 | 97 | $loop->removeReadStream($socket); |
| 98 | 98 | |
| 99 | 99 | $stream->encryptionEnabled = $toggle; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | public function toggleCrypto($socket, Deferred $deferred, $toggle, $method) |
| 119 | 119 | { |
| 120 | 120 | $error = null; |
| 121 | - \set_error_handler(function ($_, $errstr) use (&$error) { |
|
| 121 | + \set_error_handler(function($_, $errstr) use (&$error) { |
|
| 122 | 122 | $error = \str_replace(array("\r", "\n"), ' ', $errstr); |
| 123 | 123 | |
| 124 | 124 | // remove useless function name from error message |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | |
| 165 | 165 | $this->connections[] = $connection; |
| 166 | 166 | $that = $this; |
| 167 | - $connection->on('close', function () use ($that, $connection) { |
|
| 167 | + $connection->on('close', function() use ($that, $connection) { |
|
| 168 | 168 | $that->handleDisconnection($connection); |
| 169 | 169 | }); |
| 170 | 170 | |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | // parse string into array structure |
| 40 | 40 | // ignore warnings due to excessive data structures (max_input_vars and max_input_nesting_level) |
| 41 | 41 | $ret = array(); |
| 42 | - @\parse_str((string)$request->getBody(), $ret); |
|
| 42 | + @\parse_str((string) $request->getBody(), $ret); |
|
| 43 | 43 | |
| 44 | 44 | return $request->withParsedBody($ret); |
| 45 | 45 | } |
@@ -130,12 +130,12 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // get next queue position |
| 133 | - $queue =& $this->queue; |
|
| 133 | + $queue = & $this->queue; |
|
| 134 | 134 | $queue[] = null; |
| 135 | 135 | \end($queue); |
| 136 | 136 | $id = \key($queue); |
| 137 | 137 | |
| 138 | - $deferred = new Deferred(function ($_, $reject) use (&$queue, $id) { |
|
| 138 | + $deferred = new Deferred(function($_, $reject) use (&$queue, $id) { |
|
| 139 | 139 | // queued promise cancelled before its next handler is invoked |
| 140 | 140 | // remove from queue and reject explicitly |
| 141 | 141 | unset($queue[$id]); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $pending = &$this->pending; |
| 149 | 149 | $that = $this; |
| 150 | - return $deferred->promise()->then(function () use ($request, $next, $body, &$pending, $that) { |
|
| 150 | + return $deferred->promise()->then(function() use ($request, $next, $body, &$pending, $that) { |
|
| 151 | 151 | // invoke next request handler |
| 152 | 152 | ++$pending; |
| 153 | 153 | |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | $that = $this; |
| 184 | 184 | |
| 185 | - return $promise->then(function ($response) use ($that) { |
|
| 185 | + return $promise->then(function($response) use ($that) { |
|
| 186 | 186 | $that->processQueue(); |
| 187 | 187 | |
| 188 | 188 | return $response; |
| 189 | - }, function ($error) use ($that) { |
|
| 189 | + }, function($error) use ($that) { |
|
| 190 | 190 | $that->processQueue(); |
| 191 | 191 | |
| 192 | 192 | return Promise\reject($error); |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | if ($positionCrlf === false) { |
| 103 | 103 | // Header shouldn't be bigger than 1024 bytes |
| 104 | 104 | if (isset($this->buffer[static::MAX_CHUNK_HEADER_SIZE])) { |
| 105 | - $this->handleError(new Exception('Chunk header size inclusive extension bigger than' . static::MAX_CHUNK_HEADER_SIZE. ' bytes')); |
|
| 105 | + $this->handleError(new Exception('Chunk header size inclusive extension bigger than' . static::MAX_CHUNK_HEADER_SIZE . ' bytes')); |
|
| 106 | 106 | } |
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $header = \strtolower((string)\substr($this->buffer, 0, $positionCrlf)); |
|
| 110 | + $header = \strtolower((string) \substr($this->buffer, 0, $positionCrlf)); |
|
| 111 | 111 | $hexValue = $header; |
| 112 | 112 | |
| 113 | 113 | if (\strpos($header, ';') !== false) { |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | return; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $this->buffer = (string)\substr($this->buffer, $positionCrlf + 2); |
|
| 131 | + $this->buffer = (string) \substr($this->buffer, $positionCrlf + 2); |
|
| 132 | 132 | $this->headerCompleted = true; |
| 133 | 133 | if ($this->buffer === '') { |
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $chunk = (string)\substr($this->buffer, 0, $this->chunkSize - $this->transferredSize); |
|
| 138 | + $chunk = (string) \substr($this->buffer, 0, $this->chunkSize - $this->transferredSize); |
|
| 139 | 139 | |
| 140 | 140 | if ($chunk !== '') { |
| 141 | 141 | $this->transferredSize += \strlen($chunk); |
| 142 | 142 | $this->emit('data', array($chunk)); |
| 143 | - $this->buffer = (string)\substr($this->buffer, \strlen($chunk)); |
|
| 143 | + $this->buffer = (string) \substr($this->buffer, \strlen($chunk)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $positionCrlf = \strpos($this->buffer, static::CRLF); |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | $this->chunkSize = 0; |
| 155 | 155 | $this->headerCompleted = false; |
| 156 | 156 | $this->transferredSize = 0; |
| 157 | - $this->buffer = (string)\substr($this->buffer, 2); |
|
| 157 | + $this->buffer = (string) \substr($this->buffer, 2); |
|
| 158 | 158 | } elseif ($this->chunkSize === 0) { |
| 159 | 159 | // end chunk received, skip all trailer data |
| 160 | - $this->buffer = (string)\substr($this->buffer, $positionCrlf); |
|
| 160 | + $this->buffer = (string) \substr($this->buffer, $positionCrlf); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | if ($positionCrlf !== 0 && $this->chunkSize !== 0 && $this->chunkSize === $this->transferredSize && \strlen($this->buffer) > 2) { |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | */ |
| 94 | 94 | public function moveTo($targetPath) |
| 95 | 95 | { |
| 96 | - throw new RuntimeException('Not implemented'); |
|
| 96 | + throw new RuntimeException('Not implemented'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $that = $this; |
| 53 | - $next = function (ServerRequestInterface $request) use ($that, $position) { |
|
| 53 | + $next = function(ServerRequestInterface $request) use ($that, $position) { |
|
| 54 | 54 | return $that->call($request, $position + 1); |
| 55 | 55 | }; |
| 56 | 56 | |