Completed
Push — master ( d63bf6...c4123d )
by Kamil
02:31
created
src/MySQL/Transaction.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
         $query   = new Query($sql, $sqlParams);
64 64
         $command = new QueryCommand($this->database, $query);
65 65
 
66
-        $this->on('error', function ($trans, $err) use ($promise) {
66
+        $this->on('error', function($trans, $err) use ($promise) {
67 67
             return $promise->reject($err);
68 68
         });
69
-        $this->on('success', function ($trans) use ($promise, $command) {
69
+        $this->on('success', function($trans) use ($promise, $command) {
70 70
             return $promise->resolve($command);
71 71
         });
72 72
 
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 
98 98
         $promise = new Promise();
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 107
         $this->open = false;
108
-        $this->emit('commit', [ $this, $this->queue ]);
108
+        $this->emit('commit', [$this, $this->queue]);
109 109
         $this->queue = [];
110 110
 
111 111
         return $promise;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         $this->open = false;
126
-        $this->emit('rollback', [ $this ]);
126
+        $this->emit('rollback', [$this]);
127 127
         $this->queue = [];
128 128
 
129 129
         return Promise::doResolve();
Please login to merge, or discard this patch.
src/MySQL/Database.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,42 +33,42 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
333 333
         $trans->on('commit', function(TransactionInterface $trans, array $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);
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
         $size = 0;
375 375
         $sizeCap = count($queue);
376 376
 
377
-        for ($i=0; $i<$sizeCap; $i++)
377
+        for ($i = 0; $i < $sizeCap; $i++)
378 378
         {
379 379
             $command = $this->doCommand($queue[$i]);
380 380
             $command->on('error', function($command, $err) use(&$ex, $promise) {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.