Completed
Push — master ( 9d1314...5291f6 )
by kacper
02:05
created
src/MySQLReplication/Event/RowEvent/RowEvent.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -352,9 +352,9 @@
 block discarded – undo
352 352
                 $values[$name] = $this->getDatetime2($column);
353 353
             }
354 354
             elseif ($column['type'] === ConstFieldType::TIMESTAMP)
355
-			{
356
-				$values[$name] = date('c', $this->binaryDataReader->readUInt32());
357
-			}
355
+            {
356
+                $values[$name] = date('c', $this->binaryDataReader->readUInt32());
357
+            }
358 358
             elseif ($column['type'] === ConstFieldType::TIME2)
359 359
             {
360 360
                 $values[$name] = $this->getTime2($column);
Please login to merge, or discard this patch.
Braces   +37 added lines, -74 removed lines patch added patch discarded remove patch
@@ -162,8 +162,7 @@  discard block
 block discarded – undo
162 162
                         'COLUMN_KEY' => '',
163 163
                     ];
164 164
                     $type = ConstFieldType::IGNORE;
165
-                }
166
-                else
165
+                } else
167 166
                 {
168 167
                     $type = ord($data['column_types'][$i]);
169 168
                 }
@@ -302,123 +301,98 @@  discard block
 block discarded – undo
302 301
             if ($this->checkNull($null_bitmap, $nullBitmapIndex))
303 302
             {
304 303
                 $values[$name] = null;
305
-            }
306
-            elseif ($column['type'] === ConstFieldType::IGNORE)
304
+            } elseif ($column['type'] === ConstFieldType::IGNORE)
307 305
             {
308 306
                 $values[$name] = null;
309
-            }
310
-            elseif ($column['type'] === ConstFieldType::TINY)
307
+            } elseif ($column['type'] === ConstFieldType::TINY)
311 308
             {
312 309
                 if (true === $column['unsigned'])
313 310
                 {
314 311
                     $values[$name] = $this->binaryDataReader->readUInt8();
315
-                }
316
-                else
312
+                } else
317 313
                 {
318 314
                     $values[$name] = $this->binaryDataReader->readInt8();
319 315
                 }
320
-            }
321
-            elseif ($column['type'] === ConstFieldType::SHORT)
316
+            } elseif ($column['type'] === ConstFieldType::SHORT)
322 317
             {
323 318
                 if (true === $column['unsigned'])
324 319
                 {
325 320
                     $values[$name] = $this->binaryDataReader->readUInt16();
326
-                }
327
-                else
321
+                } else
328 322
                 {
329 323
                     $values[$name] = $this->binaryDataReader->readInt16();
330 324
                 }
331
-            }
332
-            elseif ($column['type'] === ConstFieldType::LONG)
325
+            } elseif ($column['type'] === ConstFieldType::LONG)
333 326
             {
334 327
                 if (true === $column['unsigned'])
335 328
                 {
336 329
                     $values[$name] = $this->binaryDataReader->readUInt32();
337
-                }
338
-                else
330
+                } else
339 331
                 {
340 332
                     $values[$name] = $this->binaryDataReader->readInt32();
341 333
                 }
342
-            }
343
-            elseif ($column['type'] === ConstFieldType::LONGLONG)
334
+            } elseif ($column['type'] === ConstFieldType::LONGLONG)
344 335
             {
345 336
                 if (true === $column['unsigned'])
346 337
                 {
347 338
                     $values[$name] = $this->binaryDataReader->readUInt64();
348
-                }
349
-                else
339
+                } else
350 340
                 {
351 341
                     $values[$name] = $this->binaryDataReader->readInt64();
352 342
                 }
353
-            }
354
-            elseif ($column['type'] === ConstFieldType::INT24)
343
+            } elseif ($column['type'] === ConstFieldType::INT24)
355 344
             {
356 345
                 if (true === $column['unsigned'])
357 346
                 {
358 347
                     $values[$name] = $this->binaryDataReader->readUInt24();
359
-                }
360
-                else
348
+                } else
361 349
                 {
362 350
                     $values[$name] = $this->binaryDataReader->readInt24();
363 351
                 }
364
-            }
365
-            elseif ($column['type'] === ConstFieldType::FLOAT)
352
+            } elseif ($column['type'] === ConstFieldType::FLOAT)
366 353
             {
367 354
                 // http://dev.mysql.com/doc/refman/5.7/en/floating-point-types.html FLOAT(7,4)
368 355
                 $values[$name] = round($this->binaryDataReader->readFloat(), 4);
369
-            }
370
-            elseif ($column['type'] === ConstFieldType::DOUBLE)
356
+            } elseif ($column['type'] === ConstFieldType::DOUBLE)
371 357
             {
372 358
                 $values[$name] = $this->binaryDataReader->readDouble();
373
-            }
374
-            elseif ($column['type'] === ConstFieldType::VARCHAR || $column['type'] === ConstFieldType::STRING)
359
+            } elseif ($column['type'] === ConstFieldType::VARCHAR || $column['type'] === ConstFieldType::STRING)
375 360
             {
376 361
                 if ($column['max_length'] > 255)
377 362
                 {
378 363
                     $values[$name] = $this->getString(2, $column);
379
-                }
380
-                else
364
+                } else
381 365
                 {
382 366
                     $values[$name] = $this->getString(1, $column);
383 367
                 }
384
-            }
385
-            elseif ($column['type'] === ConstFieldType::NEWDECIMAL)
368
+            } elseif ($column['type'] === ConstFieldType::NEWDECIMAL)
386 369
             {
387 370
                 $values[$name] = $this->getDecimal($column);
388
-            }
389
-            elseif ($column['type'] === ConstFieldType::BLOB)
371
+            } elseif ($column['type'] === ConstFieldType::BLOB)
390 372
             {
391 373
                 $values[$name] = $this->getString($column['length_size'], $column);
392
-            }
393
-            elseif ($column['type'] === ConstFieldType::DATETIME)
374
+            } elseif ($column['type'] === ConstFieldType::DATETIME)
394 375
             {
395 376
                 $values[$name] = $this->getDatetime();
396
-            }
397
-            elseif ($column['type'] === ConstFieldType::DATETIME2)
377
+            } elseif ($column['type'] === ConstFieldType::DATETIME2)
398 378
             {
399 379
                 $values[$name] = $this->getDatetime2($column);
400
-            }
401
-            elseif ($column['type'] === ConstFieldType::TIMESTAMP)
380
+            } elseif ($column['type'] === ConstFieldType::TIMESTAMP)
402 381
 			{
403 382
 				$values[$name] = date('c', $this->binaryDataReader->readUInt32());
404
-			}
405
-            elseif ($column['type'] === ConstFieldType::TIME2)
383
+			} elseif ($column['type'] === ConstFieldType::TIME2)
406 384
             {
407 385
                 $values[$name] = $this->getTime2($column);
408
-            }
409
-            elseif ($column['type'] === ConstFieldType::TIMESTAMP2)
386
+            } elseif ($column['type'] === ConstFieldType::TIMESTAMP2)
410 387
             {
411 388
                 $values[$name] = $this->getTimestamp2($column);
412
-            }
413
-            elseif ($column['type'] === ConstFieldType::DATE)
389
+            } elseif ($column['type'] === ConstFieldType::DATE)
414 390
             {
415 391
                 $values[$name] = $this->getDate();
416
-            }
417
-            elseif ($column['type'] === ConstFieldType::YEAR)
392
+            } elseif ($column['type'] === ConstFieldType::YEAR)
418 393
             {
419 394
                 $values[$name] = $this->binaryDataReader->readUInt8() + 1900;
420
-            }
421
-            elseif ($column['type'] === ConstFieldType::ENUM)
395
+            } elseif ($column['type'] === ConstFieldType::ENUM)
422 396
             {
423 397
                 $value = $this->binaryDataReader->readUIntBySize($column['size']) - 1;
424 398
 
@@ -428,24 +402,19 @@  discard block
 block discarded – undo
428 402
                 {
429 403
                     $values[$name] = $column['enum_values'][$value];
430 404
                 }
431
-            }
432
-            elseif ($column['type'] === ConstFieldType::SET)
405
+            } elseif ($column['type'] === ConstFieldType::SET)
433 406
             {
434 407
                 $values[$name] = $this->getSet($column);
435
-            }
436
-            elseif ($column['type'] === ConstFieldType::BIT)
408
+            } elseif ($column['type'] === ConstFieldType::BIT)
437 409
             {
438 410
                 $values[$name] = $this->getBit($column);
439
-            }
440
-            elseif ($column['type'] === ConstFieldType::GEOMETRY)
411
+            } elseif ($column['type'] === ConstFieldType::GEOMETRY)
441 412
             {
442 413
                 $values[$name] = $this->binaryDataReader->readLengthCodedPascalString($column['length_size']);
443
-            }
444
-            elseif ($column['type'] === ConstFieldType::JSON)
414
+            } elseif ($column['type'] === ConstFieldType::JSON)
445 415
             {
446 416
                 $values[$name] = $this->jsonBinaryDecoderFactory->makeJsonBinaryDecoder($this->getString(BinaryDataReader::UNSIGNED_INT32_LENGTH, $column))->parseToString();
447
-            }
448
-            else
417
+            } else
449 418
             {
450 419
                 throw new MySQLReplicationException('Unknown row type: ' . $column['type']);
451 420
             }
@@ -547,8 +516,7 @@  discard block
 block discarded – undo
547 516
         {
548 517
             $mask = 0;
549 518
             $res = '';
550
-        }
551
-        else
519
+        } else
552 520
         {
553 521
             $mask = -1;
554 522
             $res = '-';
@@ -683,12 +651,10 @@  discard block
 block discarded – undo
683 651
         if ($column['fsp'] === 1 || $column['fsp'] === 2)
684 652
         {
685 653
             $read = 1;
686
-        }
687
-        elseif ($column['fsp'] === 3 || $column['fsp'] === 4)
654
+        } elseif ($column['fsp'] === 3 || $column['fsp'] === 4)
688 655
         {
689 656
             $read = 2;
690
-        }
691
-        elseif ($column ['fsp'] === 5 || $column['fsp'] === 6)
657
+        } elseif ($column ['fsp'] === 5 || $column['fsp'] === 6)
692 658
         {
693 659
             $read = 3;
694 660
         }
@@ -809,8 +775,7 @@  discard block
 block discarded – undo
809 775
                 if (1 === $column['bytes'])
810 776
                 {
811 777
                     $end = $column['bits'];
812
-                }
813
-                else
778
+                } else
814 779
                 {
815 780
                     $end = $column['bits'] % 8;
816 781
                     if (0 === $end)
@@ -818,8 +783,7 @@  discard block
 block discarded – undo
818 783
                         $end = 8;
819 784
                     }
820 785
                 }
821
-            }
822
-            else
786
+            } else
823 787
             {
824 788
                 $end = 8;
825 789
             }
@@ -829,8 +793,7 @@  discard block
 block discarded – undo
829 793
                 if ($data & (1 << $bit))
830 794
                 {
831 795
                     $current_byte .= '1';
832
-                }
833
-                else
796
+                } else
834 797
                 {
835 798
                     $current_byte .= '0';
836 799
                 }
Please login to merge, or discard this patch.
src/MySQLReplication/BinLog/BinLogSocketConnect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
     {
97 97
         if (false === ($this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)))
98 98
         {
99
-            throw new BinLogException(BinLogException::UNABLE_TO_CREATE_SOCKET. socket_strerror(socket_last_error()), socket_last_error());
99
+            throw new BinLogException(BinLogException::UNABLE_TO_CREATE_SOCKET . socket_strerror(socket_last_error()), socket_last_error());
100 100
         }
101 101
         socket_set_block($this->socket);
102 102
         socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1);
Please login to merge, or discard this patch.
src/MySQLReplication/Event/Event.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -100,8 +100,7 @@  discard block
 block discarded – undo
100 100
             {
101 101
                 $this->eventDispatcher->dispatch(ConstEventsNames::TABLE_MAP, $event);
102 102
             }
103
-        }
104
-        else
103
+        } else
105 104
         {
106 105
             if ([] !== $this->config->getEventsOnly() && !in_array($eventInfo->getType(), $this->config->getEventsOnly(), true))
107 106
             {
@@ -120,40 +119,33 @@  discard block
 block discarded – undo
120 119
                 {
121 120
                     $this->eventDispatcher->dispatch(ConstEventsNames::UPDATE, $event);
122 121
                 }
123
-            }
124
-            elseif (in_array($eventInfo->getType(), [ConstEventType::WRITE_ROWS_EVENT_V1, ConstEventType::WRITE_ROWS_EVENT_V2], true))
122
+            } elseif (in_array($eventInfo->getType(), [ConstEventType::WRITE_ROWS_EVENT_V1, ConstEventType::WRITE_ROWS_EVENT_V2], true))
125 123
             {
126 124
                 $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeWriteRowsDTO();
127 125
                 if ($event !== null)
128 126
                 {
129 127
                     $this->eventDispatcher->dispatch(ConstEventsNames::WRITE, $event);
130 128
                 }
131
-            }
132
-            elseif (in_array($eventInfo->getType(), [ConstEventType::DELETE_ROWS_EVENT_V1, ConstEventType::DELETE_ROWS_EVENT_V2], true))
129
+            } elseif (in_array($eventInfo->getType(), [ConstEventType::DELETE_ROWS_EVENT_V1, ConstEventType::DELETE_ROWS_EVENT_V2], true))
133 130
             {
134 131
                 $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeDeleteRowsDTO();
135 132
                 if ($event !== null)
136 133
                 {
137 134
                     $this->eventDispatcher->dispatch(ConstEventsNames::DELETE, $event);
138 135
                 }
139
-            }
140
-            elseif (ConstEventType::XID_EVENT === $eventInfo->getType())
136
+            } elseif (ConstEventType::XID_EVENT === $eventInfo->getType())
141 137
             {
142 138
                 $this->eventDispatcher->dispatch(ConstEventsNames::XID, (new XidEvent($eventInfo, $binaryDataReader))->makeXidDTO());
143
-            }
144
-            elseif (ConstEventType::ROTATE_EVENT === $eventInfo->getType())
139
+            } elseif (ConstEventType::ROTATE_EVENT === $eventInfo->getType())
145 140
             {
146 141
                 $this->eventDispatcher->dispatch(ConstEventsNames::ROTATE, (new RotateEvent($eventInfo, $binaryDataReader))->makeRotateEventDTO());
147
-            }
148
-            elseif (ConstEventType::GTID_LOG_EVENT === $eventInfo->getType())
142
+            } elseif (ConstEventType::GTID_LOG_EVENT === $eventInfo->getType())
149 143
             {
150 144
                 $this->eventDispatcher->dispatch(ConstEventsNames::GTID, (new GtidEvent($eventInfo, $binaryDataReader))->makeGTIDLogDTO());
151
-            }
152
-            elseif (ConstEventType::QUERY_EVENT === $eventInfo->getType())
145
+            } elseif (ConstEventType::QUERY_EVENT === $eventInfo->getType())
153 146
             {
154 147
                 $this->eventDispatcher->dispatch(ConstEventsNames::QUERY, (new QueryEvent($eventInfo, $binaryDataReader))->makeQueryDTO());
155
-            }
156
-            elseif (ConstEventType::MARIA_GTID_EVENT === $eventInfo->getType())
148
+            } elseif (ConstEventType::MARIA_GTID_EVENT === $eventInfo->getType())
157 149
             {
158 150
                 $this->eventDispatcher->dispatch(ConstEventsNames::MARIADB_GTID, (new MariaDbGtidEvent($eventInfo, $binaryDataReader))->makeMariaDbGTIDLogDTO());
159 151
             }
Please login to merge, or discard this patch.
src/MySQLReplication/Event/RowEvent/Columns.php 1 patch
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -46,53 +46,41 @@  discard block
 block discarded – undo
46 46
         if (self::$field['type'] === ConstFieldType::VARCHAR)
47 47
         {
48 48
             self::$field['max_length'] = $binaryDataReader->readInt16();
49
-        }
50
-        elseif (self::$field['type'] === ConstFieldType::DOUBLE)
49
+        } elseif (self::$field['type'] === ConstFieldType::DOUBLE)
51 50
         {
52 51
             self::$field['size'] = $binaryDataReader->readUInt8();
53
-        }
54
-        elseif (self::$field['type'] === ConstFieldType::FLOAT)
52
+        } elseif (self::$field['type'] === ConstFieldType::FLOAT)
55 53
         {
56 54
             self::$field['size'] = $binaryDataReader->readUInt8();
57
-        }
58
-        elseif (self::$field['type'] === ConstFieldType::TIMESTAMP2)
55
+        } elseif (self::$field['type'] === ConstFieldType::TIMESTAMP2)
59 56
         {
60 57
             self::$field['fsp'] = $binaryDataReader->readUInt8();
61
-        }
62
-        elseif (self::$field['type'] === ConstFieldType::DATETIME2)
58
+        } elseif (self::$field['type'] === ConstFieldType::DATETIME2)
63 59
         {
64 60
             self::$field['fsp'] = $binaryDataReader->readUInt8();
65
-        }
66
-        elseif (self::$field['type'] === ConstFieldType::TIME2)
61
+        } elseif (self::$field['type'] === ConstFieldType::TIME2)
67 62
         {
68 63
             self::$field['fsp'] = $binaryDataReader->readUInt8();
69
-        }
70
-        elseif (self::$field['type'] === ConstFieldType::TINY && $columnSchema['COLUMN_TYPE'] === 'tinyint(1)')
64
+        } elseif (self::$field['type'] === ConstFieldType::TINY && $columnSchema['COLUMN_TYPE'] === 'tinyint(1)')
71 65
         {
72 66
             self::$field['type_is_bool'] = true;
73
-        }
74
-        elseif (self::$field['type'] === ConstFieldType::VAR_STRING || self::$field['type'] === ConstFieldType::STRING)
67
+        } elseif (self::$field['type'] === ConstFieldType::VAR_STRING || self::$field['type'] === ConstFieldType::STRING)
75 68
         {
76 69
             self::getFieldSpecial($binaryDataReader, $columnSchema);
77
-        }
78
-        elseif (self::$field['type'] === ConstFieldType::BLOB)
70
+        } elseif (self::$field['type'] === ConstFieldType::BLOB)
79 71
         {
80 72
             self::$field['length_size'] = $binaryDataReader->readUInt8();
81
-        }
82
-        elseif (self::$field['type'] === ConstFieldType::GEOMETRY)
73
+        } elseif (self::$field['type'] === ConstFieldType::GEOMETRY)
83 74
         {
84 75
             self::$field['length_size'] = $binaryDataReader->readUInt8();
85
-        }
86
-        elseif (self::$field['type'] === ConstFieldType::JSON)
76
+        } elseif (self::$field['type'] === ConstFieldType::JSON)
87 77
         {
88 78
             self::$field['length_size'] = $binaryDataReader->readUInt8();
89
-        }
90
-        elseif (self::$field['type'] === ConstFieldType::NEWDECIMAL)
79
+        } elseif (self::$field['type'] === ConstFieldType::NEWDECIMAL)
91 80
         {
92 81
             self::$field['precision'] = $binaryDataReader->readUInt8();
93 82
             self::$field['decimals'] = $binaryDataReader->readUInt8();
94
-        }
95
-        elseif (self::$field['type'] === ConstFieldType::BIT)
83
+        } elseif (self::$field['type'] === ConstFieldType::BIT)
96 84
         {
97 85
             $bits = $binaryDataReader->readUInt8();
98 86
             $bytes = $binaryDataReader->readUInt8();
@@ -117,8 +105,7 @@  discard block
 block discarded – undo
117 105
             self::$field['type'] = $real_type;
118 106
             self::$field['size'] = $metadata & 0x00ff;
119 107
             self::getFieldSpecialValues($columnSchema);
120
-        }
121
-        else
108
+        } else
122 109
         {
123 110
             self::$field['max_length'] = ((($metadata >> 4) & 0x300) ^ 0x300) + ($metadata & 0x00ff);
124 111
         }
@@ -133,12 +120,10 @@  discard block
 block discarded – undo
133 120
         if (self::$field['type'] === ConstFieldType::ENUM)
134 121
         {
135 122
             self::$field['enum_values'] = explode(',', str_replace(['enum(', ')', '\''], '', $columnSchema['COLUMN_TYPE']));
136
-        }
137
-        else if (self::$field['type'] === ConstFieldType::SET)
123
+        } else if (self::$field['type'] === ConstFieldType::SET)
138 124
         {
139 125
             self::$field['set_values'] = explode(',', str_replace(['set(', ')', '\''], '', $columnSchema['COLUMN_TYPE']));
140
-        }
141
-        else
126
+        } else
142 127
         {
143 128
             throw new ConfigException('Type not handled! - ' . self::$field['type']);
144 129
         }
Please login to merge, or discard this patch.