@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | $query = new Query($sql, $sqlParams); |
| 63 | 63 | $command = new QueryCommand($this->database, $query); |
| 64 | 64 | |
| 65 | - $this->on('error', function ($trans, $err) use ($promise) { |
|
| 65 | + $this->on('error', function($trans, $err) use ($promise) { |
|
| 66 | 66 | return $promise->reject($err); |
| 67 | 67 | }); |
| 68 | - $this->on('success', function ($trans) use ($promise, $command) { |
|
| 68 | + $this->on('success', function($trans) use ($promise, $command) { |
|
| 69 | 69 | return $promise->resolve($command); |
| 70 | 70 | }); |
| 71 | 71 | |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | $promise = new Promise(); |
| 98 | 98 | $this->open = false; |
| 99 | 99 | |
| 100 | - $this->on('error', function ($trans, $err) use ($promise) { |
|
| 100 | + $this->on('error', function($trans, $err) use ($promise) { |
|
| 101 | 101 | return $promise->reject($err); |
| 102 | 102 | }); |
| 103 | - $this->on('success', function ($trans) use ($promise) { |
|
| 103 | + $this->on('success', function($trans) use ($promise) { |
|
| 104 | 104 | return $promise->resolve(); |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | - $this->emit('commit', [ $this, $this->queue ]); |
|
| 107 | + $this->emit('commit', [$this, $this->queue]); |
|
| 108 | 108 | $this->queue = null; |
| 109 | 109 | |
| 110 | 110 | return $promise; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $this->open = false; |
| 125 | - $this->emit('rollback', [ $this ]); |
|
| 125 | + $this->emit('rollback', [$this]); |
|
| 126 | 126 | $this->queue = null; |
| 127 | 127 | |
| 128 | 128 | return Promise::doResolve(); |
@@ -33,42 +33,42 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @var int |
| 35 | 35 | */ |
| 36 | - const STATE_INIT = 0; |
|
| 36 | + const STATE_INIT = 0; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @var int |
| 40 | 40 | */ |
| 41 | - const STATE_CONNECT_PENDING = 4; |
|
| 41 | + const STATE_CONNECT_PENDING = 4; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @var int |
| 45 | 45 | */ |
| 46 | - const STATE_CONNECT_FAILED = 2; |
|
| 46 | + const STATE_CONNECT_FAILED = 2; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * @var int |
| 50 | 50 | */ |
| 51 | - const STATE_CONNECT_SUCCEEDED = 6; |
|
| 51 | + const STATE_CONNECT_SUCCEEDED = 6; |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * @var int |
| 55 | 55 | */ |
| 56 | - const STATE_AUTH_PENDING = 5; |
|
| 56 | + const STATE_AUTH_PENDING = 5; |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @var int |
| 60 | 60 | */ |
| 61 | - const STATE_AUTH_FAILED = 3; |
|
| 61 | + const STATE_AUTH_FAILED = 3; |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * @var int |
| 65 | 65 | */ |
| 66 | - const STATE_AUTH_SUCCEEDED = 7; |
|
| 66 | + const STATE_AUTH_SUCCEEDED = 7; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * @var int |
| 70 | 70 | */ |
| 71 | - const STATE_DISCONNECT_PENDING = 8; |
|
| 71 | + const STATE_DISCONNECT_PENDING = 8; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @var int |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | $this->state = self::STATE_CONNECT_PENDING; |
| 180 | 180 | $config = $this->config; |
| 181 | 181 | |
| 182 | - $errorHandler = function ($command, $reason) use ($promise) { |
|
| 182 | + $errorHandler = function($command, $reason) use ($promise) { |
|
| 183 | 183 | $this->state = self::STATE_AUTH_FAILED; |
| 184 | 184 | return $promise->reject($reason); |
| 185 | 185 | }; |
| 186 | 186 | |
| 187 | - $connectedHandler = function ($command, $info) use ($promise) { |
|
| 187 | + $connectedHandler = function($command, $info) use ($promise) { |
|
| 188 | 188 | $this->state = self::STATE_AUTH_SUCCEEDED; |
| 189 | 189 | $this->serverInfo = $info; |
| 190 | 190 | return $promise->resolve($info); |
@@ -195,8 +195,8 @@ discard block |
||
| 195 | 195 | ->then(function($stream) use ($config, $errorHandler, $connectedHandler) { |
| 196 | 196 | $this->stream = $stream; |
| 197 | 197 | |
| 198 | - $stream->on('error', [ $this, 'handleSocketError' ]); |
|
| 199 | - $stream->on('close', [ $this, 'handleSocketClose' ]); |
|
| 198 | + $stream->on('error', [$this, 'handleSocketError']); |
|
| 199 | + $stream->on('close', [$this, 'handleSocketClose']); |
|
| 200 | 200 | |
| 201 | 201 | $this->state = self::STATE_AUTH_PENDING; |
| 202 | 202 | $this->parser = new ProtocolParser($stream, $this->queue, $config); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $this->parser->start(); |
| 209 | 209 | }) |
| 210 | - ->done(null, [ $this, 'handleError' ]); |
|
| 210 | + ->done(null, [$this, 'handleError']); |
|
| 211 | 211 | |
| 212 | 212 | return $promise; |
| 213 | 213 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | ->doCommand(new QuitCommand($this)) |
| 228 | 228 | ->on('success', function() use($resolve) { |
| 229 | 229 | $this->state = self::STATE_DISCONNECT_SUCCEEDED; |
| 230 | - $this->emit('stop', [ $this ]); |
|
| 230 | + $this->emit('stop', [$this]); |
|
| 231 | 231 | $resolve($this); |
| 232 | 232 | }); |
| 233 | 233 | $this->state = self::STATE_DISCONNECT_PENDING; |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | $this->doCommand($command); |
| 284 | 284 | |
| 285 | - $command->on('error', function ($command, $err) use ($promise) { |
|
| 285 | + $command->on('error', function($command, $err) use ($promise) { |
|
| 286 | 286 | return $promise->reject($err); |
| 287 | 287 | }); |
| 288 | - $command->on('success', function ($command) use ($promise) { |
|
| 288 | + $command->on('success', function($command) use ($promise) { |
|
| 289 | 289 | return $promise->resolve($command); |
| 290 | 290 | }); |
| 291 | 291 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | $promise = new Promise(); |
| 313 | 313 | |
| 314 | 314 | $command = $this->doCommand(new PingCommand($this)); |
| 315 | - $command->on('error', function ($command, $reason) use ($promise) { |
|
| 315 | + $command->on('error', function($command, $reason) use ($promise) { |
|
| 316 | 316 | return $promise->reject($reason); |
| 317 | 317 | }); |
| 318 | - $command->on('success', function () use ($promise) { |
|
| 318 | + $command->on('success', function() use ($promise) { |
|
| 319 | 319 | return $promise->resolve(); |
| 320 | 320 | }); |
| 321 | 321 | |
@@ -333,10 +333,10 @@ discard block |
||
| 333 | 333 | $trans->on('commit', function(TransactionInterface $trans, SplQueue $queue) { |
| 334 | 334 | $this->commitTransaction($queue)->then( |
| 335 | 335 | function() use($trans) { |
| 336 | - return $trans->emit('success', [ $trans ]); |
|
| 336 | + return $trans->emit('success', [$trans]); |
|
| 337 | 337 | }, |
| 338 | 338 | function($ex) use($trans) { |
| 339 | - return $trans->emit('error', [ $trans, $ex ]); |
|
| 339 | + return $trans->emit('error', [$trans, $ex]); |
|
| 340 | 340 | } |
| 341 | 341 | ); |
| 342 | 342 | $this->transBox->remove($trans); |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | */ |
| 417 | 417 | public function handleError($err) |
| 418 | 418 | { |
| 419 | - $this->emit('error', [ $this, $err ]); |
|
| 419 | + $this->emit('error', [$this, $err]); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | /** |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | public function handleSocketError($socket, $err) |
| 426 | 426 | { |
| 427 | - $this->emit('error', [ $this, $err ]); |
|
| 427 | + $this->emit('error', [$this, $err]); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | if ($this->state < self::STATE_DISCONNECT_PENDING) |
| 436 | 436 | { |
| 437 | 437 | $this->state = self::STATE_DISCONNECT_SUCCEEDED; |
| 438 | - $this->emit('error', [ $this, new RuntimeException('MySQL server has gone away!') ]); |
|
| 438 | + $this->emit('error', [$this, new RuntimeException('MySQL server has gone away!')]); |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |