@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $i++; |
37 | 37 | break; |
38 | - } |
|
39 | - else |
|
38 | + } else |
|
40 | 39 | { |
41 | 40 | self::$serverInfo['server_version'] .= $pack[$i]; |
42 | 41 | } |
@@ -116,8 +115,7 @@ discard block |
||
116 | 115 | if (false !== strpos($version, self::MYSQL_VERSION_MARIADB)) |
117 | 116 | { |
118 | 117 | self::$serverInfo['version_name'] = self::MYSQL_VERSION_MARIADB; |
119 | - } |
|
120 | - else if (false !== strpos($version, self::MYSQL_VERSION_PERCONA)) |
|
118 | + } else if (false !== strpos($version, self::MYSQL_VERSION_PERCONA)) |
|
121 | 119 | { |
122 | 120 | self::$serverInfo['version_name'] = self::MYSQL_VERSION_PERCONA; |
123 | 121 | } |
@@ -171,8 +171,7 @@ discard block |
||
171 | 171 | if (in_array($head, $this->packageOkHeader, true)) |
172 | 172 | { |
173 | 173 | return ['status' => true, 'code' => 0, 'msg' => '']; |
174 | - } |
|
175 | - else |
|
174 | + } else |
|
176 | 175 | { |
177 | 176 | $error_code = unpack('v', $packet[1] . $packet[2])[1]; |
178 | 177 | $error_msg = ''; |
@@ -230,8 +229,7 @@ discard block |
||
230 | 229 | if ('' !== $this->config->getGtid()) |
231 | 230 | { |
232 | 231 | $this->setBinLogDumpGtid(); |
233 | - } |
|
234 | - else |
|
232 | + } else |
|
235 | 233 | { |
236 | 234 | $this->setBinLogDump(); |
237 | 235 | } |
@@ -53,8 +53,7 @@ |
||
53 | 53 | { |
54 | 54 | $buffer .= BinaryDataReader::pack64bit($interval[0]); |
55 | 55 | $buffer .= BinaryDataReader::pack64bit($interval[1]); |
56 | - } |
|
57 | - else |
|
56 | + } else |
|
58 | 57 | { |
59 | 58 | $buffer .= BinaryDataReader::pack64bit($interval[0]); |
60 | 59 | $buffer .= BinaryDataReader::pack64bit($interval[0] + 1); |
@@ -109,17 +109,14 @@ discard block |
||
109 | 109 | if ($c < self::UNSIGNED_CHAR_COLUMN) |
110 | 110 | { |
111 | 111 | return $c; |
112 | - } |
|
113 | - elseif ($c == self::UNSIGNED_SHORT_COLUMN) |
|
112 | + } elseif ($c == self::UNSIGNED_SHORT_COLUMN) |
|
114 | 113 | { |
115 | 114 | return $this->readUInt16(); |
116 | 115 | |
117 | - } |
|
118 | - elseif ($c == self::UNSIGNED_INT24_COLUMN) |
|
116 | + } elseif ($c == self::UNSIGNED_INT24_COLUMN) |
|
119 | 117 | { |
120 | 118 | return $this->readUInt24(); |
121 | - } |
|
122 | - elseif ($c == self::UNSIGNED_INT64_COLUMN) |
|
119 | + } elseif ($c == self::UNSIGNED_INT64_COLUMN) |
|
123 | 120 | { |
124 | 121 | return $this->readUInt64(); |
125 | 122 | } |
@@ -208,32 +205,25 @@ discard block |
||
208 | 205 | if ($size == self::UNSIGNED_CHAR_LENGTH) |
209 | 206 | { |
210 | 207 | return $this->readUInt8(); |
211 | - } |
|
212 | - elseif ($size == self::UNSIGNED_SHORT_LENGTH) |
|
208 | + } elseif ($size == self::UNSIGNED_SHORT_LENGTH) |
|
213 | 209 | { |
214 | 210 | return $this->readUInt16(); |
215 | - } |
|
216 | - elseif ($size == self::UNSIGNED_INT24_LENGTH) |
|
211 | + } elseif ($size == self::UNSIGNED_INT24_LENGTH) |
|
217 | 212 | { |
218 | 213 | return $this->readUInt24(); |
219 | - } |
|
220 | - elseif ($size == self::UNSIGNED_INT32_LENGTH) |
|
214 | + } elseif ($size == self::UNSIGNED_INT32_LENGTH) |
|
221 | 215 | { |
222 | 216 | return $this->readUInt32(); |
223 | - } |
|
224 | - elseif ($size == self::UNSIGNED_INT40_LENGTH) |
|
217 | + } elseif ($size == self::UNSIGNED_INT40_LENGTH) |
|
225 | 218 | { |
226 | 219 | return $this->readUInt40(); |
227 | - } |
|
228 | - elseif ($size == self::UNSIGNED_INT48_LENGTH) |
|
220 | + } elseif ($size == self::UNSIGNED_INT48_LENGTH) |
|
229 | 221 | { |
230 | 222 | return $this->readUInt48(); |
231 | - } |
|
232 | - elseif ($size == self::UNSIGNED_INT56_LENGTH) |
|
223 | + } elseif ($size == self::UNSIGNED_INT56_LENGTH) |
|
233 | 224 | { |
234 | 225 | return $this->readUInt56(); |
235 | - } |
|
236 | - elseif ($size == self::UNSIGNED_INT64_LENGTH) |
|
226 | + } elseif ($size == self::UNSIGNED_INT64_LENGTH) |
|
237 | 227 | { |
238 | 228 | return $this->readUInt64(); |
239 | 229 | } |
@@ -302,20 +292,16 @@ discard block |
||
302 | 292 | if ($size == self::UNSIGNED_CHAR_LENGTH) |
303 | 293 | { |
304 | 294 | return $this->readInt8(); |
305 | - } |
|
306 | - elseif ($size == self::UNSIGNED_SHORT_LENGTH) |
|
295 | + } elseif ($size == self::UNSIGNED_SHORT_LENGTH) |
|
307 | 296 | { |
308 | 297 | return $this->readInt16Be(); |
309 | - } |
|
310 | - elseif ($size == self::UNSIGNED_INT24_LENGTH) |
|
298 | + } elseif ($size == self::UNSIGNED_INT24_LENGTH) |
|
311 | 299 | { |
312 | 300 | return $this->readInt24Be(); |
313 | - } |
|
314 | - elseif ($size == self::UNSIGNED_INT32_LENGTH) |
|
301 | + } elseif ($size == self::UNSIGNED_INT32_LENGTH) |
|
315 | 302 | { |
316 | 303 | return $this->readInt32Be(); |
317 | - } |
|
318 | - elseif ($size == self::UNSIGNED_INT40_LENGTH) |
|
304 | + } elseif ($size == self::UNSIGNED_INT40_LENGTH) |
|
319 | 305 | { |
320 | 306 | return $this->readInt40Be(); |
321 | 307 | } |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | ); |
87 | 87 | |
88 | 88 | if (ConstEventType::TABLE_MAP_EVENT === $eventInfo->getType()) { |
89 | - $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeTableMapDTO(); |
|
90 | - if ($event !== null) { |
|
91 | - $this->eventDispatcher->dispatch(ConstEventsNames::TABLE_MAP, $event); |
|
92 | - } |
|
89 | + $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeTableMapDTO(); |
|
90 | + if ($event !== null) { |
|
91 | + $this->eventDispatcher->dispatch(ConstEventsNames::TABLE_MAP, $event); |
|
92 | + } |
|
93 | 93 | } else { |
94 | 94 | if ([] !== $this->config->getEventsOnly() && !in_array($eventInfo->getType(), $this->config->getEventsOnly(), true)) { |
95 | 95 | return; |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | if (in_array($eventInfo->getType(), [ConstEventType::UPDATE_ROWS_EVENT_V1, ConstEventType::UPDATE_ROWS_EVENT_V2], true)) { |
103 | - $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeUpdateRowsDTO(); |
|
104 | - if ($event !== null) { |
|
105 | - $this->eventDispatcher->dispatch(ConstEventsNames::UPDATE, $event); |
|
106 | - } |
|
103 | + $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeUpdateRowsDTO(); |
|
104 | + if ($event !== null) { |
|
105 | + $this->eventDispatcher->dispatch(ConstEventsNames::UPDATE, $event); |
|
106 | + } |
|
107 | 107 | } elseif (in_array($eventInfo->getType(), [ConstEventType::WRITE_ROWS_EVENT_V1, ConstEventType::WRITE_ROWS_EVENT_V2], true)) { |
108 | - $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeWriteRowsDTO(); |
|
109 | - if ($event !== null) { |
|
110 | - $this->eventDispatcher->dispatch(ConstEventsNames::WRITE, $event); |
|
111 | - } |
|
108 | + $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeWriteRowsDTO(); |
|
109 | + if ($event !== null) { |
|
110 | + $this->eventDispatcher->dispatch(ConstEventsNames::WRITE, $event); |
|
111 | + } |
|
112 | 112 | } elseif (in_array($eventInfo->getType(), [ConstEventType::DELETE_ROWS_EVENT_V1, ConstEventType::DELETE_ROWS_EVENT_V2], true)) { |
113 | - $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeDeleteRowsDTO(); |
|
114 | - if ($event !== null) { |
|
115 | - $this->eventDispatcher->dispatch(ConstEventsNames::DELETE, $event); |
|
116 | - } |
|
113 | + $event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeDeleteRowsDTO(); |
|
114 | + if ($event !== null) { |
|
115 | + $this->eventDispatcher->dispatch(ConstEventsNames::DELETE, $event); |
|
116 | + } |
|
117 | 117 | } elseif (ConstEventType::XID_EVENT === $eventInfo->getType()) { |
118 | 118 | $this->eventDispatcher->dispatch(ConstEventsNames::XID, (new XidEvent($eventInfo, $binaryDataReader))->makeXidDTO()); |
119 | 119 | } elseif (ConstEventType::ROTATE_EVENT === $eventInfo->getType()) { |
@@ -2,22 +2,22 @@ |
||
2 | 2 | |
3 | 3 | namespace MySQLReplication\Event\RowEvent; |
4 | 4 | |
5 | -use MySQLReplication\BinaryDataReader\BinaryDataReader; |
|
6 | -use MySQLReplication\BinaryDataReader\Exception\BinaryDataReaderException; |
|
7 | -use MySQLReplication\Config\Config; |
|
8 | -use MySQLReplication\Config\Exception\ConfigException; |
|
9 | -use MySQLReplication\Definitions\ConstEventType; |
|
10 | -use MySQLReplication\Definitions\ConstFieldType; |
|
11 | -use MySQLReplication\Event\DTO\DeleteRowsDTO; |
|
12 | -use MySQLReplication\Event\DTO\TableMapDTO; |
|
13 | -use MySQLReplication\Event\DTO\UpdateRowsDTO; |
|
14 | -use MySQLReplication\Event\DTO\WriteRowsDTO; |
|
15 | -use MySQLReplication\Event\EventCommon; |
|
16 | -use MySQLReplication\Event\EventInfo; |
|
17 | -use MySQLReplication\Event\Exception\EventException; |
|
18 | -use MySQLReplication\Exception\MySQLReplicationException; |
|
19 | -use MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderException; |
|
20 | -use MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderFactory; |
|
5 | +use MySQLReplication\BinaryDataReader\BinaryDataReader; |
|
6 | +use MySQLReplication\BinaryDataReader\Exception\BinaryDataReaderException; |
|
7 | +use MySQLReplication\Config\Config; |
|
8 | +use MySQLReplication\Config\Exception\ConfigException; |
|
9 | +use MySQLReplication\Definitions\ConstEventType; |
|
10 | +use MySQLReplication\Definitions\ConstFieldType; |
|
11 | +use MySQLReplication\Event\DTO\DeleteRowsDTO; |
|
12 | +use MySQLReplication\Event\DTO\TableMapDTO; |
|
13 | +use MySQLReplication\Event\DTO\UpdateRowsDTO; |
|
14 | +use MySQLReplication\Event\DTO\WriteRowsDTO; |
|
15 | +use MySQLReplication\Event\EventCommon; |
|
16 | +use MySQLReplication\Event\EventInfo; |
|
17 | +use MySQLReplication\Event\Exception\EventException; |
|
18 | +use MySQLReplication\Exception\MySQLReplicationException; |
|
19 | +use MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderException; |
|
20 | +use MySQLReplication\JsonBinaryDecoder\JsonBinaryDecoderFactory; |
|
21 | 21 | use MySQLReplication\Repository\MySQLRepository; |
22 | 22 | |
23 | 23 | /** |
@@ -401,9 +401,9 @@ |
||
401 | 401 | $values[$name] = $this->getDatetime2($column); |
402 | 402 | } |
403 | 403 | elseif ($column['type'] === ConstFieldType::TIMESTAMP) |
404 | - { |
|
405 | - $values[$name] = date('c', $this->binaryDataReader->readUInt32()); |
|
406 | - } |
|
404 | + { |
|
405 | + $values[$name] = date('c', $this->binaryDataReader->readUInt32()); |
|
406 | + } |
|
407 | 407 | elseif ($column['type'] === ConstFieldType::TIME2) |
408 | 408 | { |
409 | 409 | $values[$name] = $this->getTime2($column); |
@@ -164,8 +164,7 @@ discard block |
||
164 | 164 | 'COLUMN_KEY' => '', |
165 | 165 | ]; |
166 | 166 | $type = ConstFieldType::IGNORE; |
167 | - } |
|
168 | - else |
|
167 | + } else |
|
169 | 168 | { |
170 | 169 | $type = ord($data['column_types'][$i]); |
171 | 170 | } |
@@ -304,123 +303,98 @@ discard block |
||
304 | 303 | if ($this->checkNull($null_bitmap, $nullBitmapIndex)) |
305 | 304 | { |
306 | 305 | $values[$name] = null; |
307 | - } |
|
308 | - elseif ($column['type'] === ConstFieldType::IGNORE) |
|
306 | + } elseif ($column['type'] === ConstFieldType::IGNORE) |
|
309 | 307 | { |
310 | 308 | $values[$name] = null; |
311 | - } |
|
312 | - elseif ($column['type'] === ConstFieldType::TINY) |
|
309 | + } elseif ($column['type'] === ConstFieldType::TINY) |
|
313 | 310 | { |
314 | 311 | if (true === $column['unsigned']) |
315 | 312 | { |
316 | 313 | $values[$name] = $this->binaryDataReader->readUInt8(); |
317 | - } |
|
318 | - else |
|
314 | + } else |
|
319 | 315 | { |
320 | 316 | $values[$name] = $this->binaryDataReader->readInt8(); |
321 | 317 | } |
322 | - } |
|
323 | - elseif ($column['type'] === ConstFieldType::SHORT) |
|
318 | + } elseif ($column['type'] === ConstFieldType::SHORT) |
|
324 | 319 | { |
325 | 320 | if (true === $column['unsigned']) |
326 | 321 | { |
327 | 322 | $values[$name] = $this->binaryDataReader->readUInt16(); |
328 | - } |
|
329 | - else |
|
323 | + } else |
|
330 | 324 | { |
331 | 325 | $values[$name] = $this->binaryDataReader->readInt16(); |
332 | 326 | } |
333 | - } |
|
334 | - elseif ($column['type'] === ConstFieldType::LONG) |
|
327 | + } elseif ($column['type'] === ConstFieldType::LONG) |
|
335 | 328 | { |
336 | 329 | if (true === $column['unsigned']) |
337 | 330 | { |
338 | 331 | $values[$name] = $this->binaryDataReader->readUInt32(); |
339 | - } |
|
340 | - else |
|
332 | + } else |
|
341 | 333 | { |
342 | 334 | $values[$name] = $this->binaryDataReader->readInt32(); |
343 | 335 | } |
344 | - } |
|
345 | - elseif ($column['type'] === ConstFieldType::LONGLONG) |
|
336 | + } elseif ($column['type'] === ConstFieldType::LONGLONG) |
|
346 | 337 | { |
347 | 338 | if (true === $column['unsigned']) |
348 | 339 | { |
349 | 340 | $values[$name] = $this->binaryDataReader->readUInt64(); |
350 | - } |
|
351 | - else |
|
341 | + } else |
|
352 | 342 | { |
353 | 343 | $values[$name] = $this->binaryDataReader->readInt64(); |
354 | 344 | } |
355 | - } |
|
356 | - elseif ($column['type'] === ConstFieldType::INT24) |
|
345 | + } elseif ($column['type'] === ConstFieldType::INT24) |
|
357 | 346 | { |
358 | 347 | if (true === $column['unsigned']) |
359 | 348 | { |
360 | 349 | $values[$name] = $this->binaryDataReader->readUInt24(); |
361 | - } |
|
362 | - else |
|
350 | + } else |
|
363 | 351 | { |
364 | 352 | $values[$name] = $this->binaryDataReader->readInt24(); |
365 | 353 | } |
366 | - } |
|
367 | - elseif ($column['type'] === ConstFieldType::FLOAT) |
|
354 | + } elseif ($column['type'] === ConstFieldType::FLOAT) |
|
368 | 355 | { |
369 | 356 | // http://dev.mysql.com/doc/refman/5.7/en/floating-point-types.html FLOAT(7,4) |
370 | 357 | $values[$name] = round($this->binaryDataReader->readFloat(), 4); |
371 | - } |
|
372 | - elseif ($column['type'] === ConstFieldType::DOUBLE) |
|
358 | + } elseif ($column['type'] === ConstFieldType::DOUBLE) |
|
373 | 359 | { |
374 | 360 | $values[$name] = $this->binaryDataReader->readDouble(); |
375 | - } |
|
376 | - elseif ($column['type'] === ConstFieldType::VARCHAR || $column['type'] === ConstFieldType::STRING) |
|
361 | + } elseif ($column['type'] === ConstFieldType::VARCHAR || $column['type'] === ConstFieldType::STRING) |
|
377 | 362 | { |
378 | 363 | if ($column['max_length'] > 255) |
379 | 364 | { |
380 | 365 | $values[$name] = $this->getString(2, $column); |
381 | - } |
|
382 | - else |
|
366 | + } else |
|
383 | 367 | { |
384 | 368 | $values[$name] = $this->getString(1, $column); |
385 | 369 | } |
386 | - } |
|
387 | - elseif ($column['type'] === ConstFieldType::NEWDECIMAL) |
|
370 | + } elseif ($column['type'] === ConstFieldType::NEWDECIMAL) |
|
388 | 371 | { |
389 | 372 | $values[$name] = $this->getDecimal($column); |
390 | - } |
|
391 | - elseif ($column['type'] === ConstFieldType::BLOB) |
|
373 | + } elseif ($column['type'] === ConstFieldType::BLOB) |
|
392 | 374 | { |
393 | 375 | $values[$name] = $this->getString($column['length_size'], $column); |
394 | - } |
|
395 | - elseif ($column['type'] === ConstFieldType::DATETIME) |
|
376 | + } elseif ($column['type'] === ConstFieldType::DATETIME) |
|
396 | 377 | { |
397 | 378 | $values[$name] = $this->getDatetime(); |
398 | - } |
|
399 | - elseif ($column['type'] === ConstFieldType::DATETIME2) |
|
379 | + } elseif ($column['type'] === ConstFieldType::DATETIME2) |
|
400 | 380 | { |
401 | 381 | $values[$name] = $this->getDatetime2($column); |
402 | - } |
|
403 | - elseif ($column['type'] === ConstFieldType::TIMESTAMP) |
|
382 | + } elseif ($column['type'] === ConstFieldType::TIMESTAMP) |
|
404 | 383 | { |
405 | 384 | $values[$name] = date('c', $this->binaryDataReader->readUInt32()); |
406 | - } |
|
407 | - elseif ($column['type'] === ConstFieldType::TIME2) |
|
385 | + } elseif ($column['type'] === ConstFieldType::TIME2) |
|
408 | 386 | { |
409 | 387 | $values[$name] = $this->getTime2($column); |
410 | - } |
|
411 | - elseif ($column['type'] === ConstFieldType::TIMESTAMP2) |
|
388 | + } elseif ($column['type'] === ConstFieldType::TIMESTAMP2) |
|
412 | 389 | { |
413 | 390 | $values[$name] = $this->getTimestamp2($column); |
414 | - } |
|
415 | - elseif ($column['type'] === ConstFieldType::DATE) |
|
391 | + } elseif ($column['type'] === ConstFieldType::DATE) |
|
416 | 392 | { |
417 | 393 | $values[$name] = $this->getDate(); |
418 | - } |
|
419 | - elseif ($column['type'] === ConstFieldType::YEAR) |
|
394 | + } elseif ($column['type'] === ConstFieldType::YEAR) |
|
420 | 395 | { |
421 | 396 | $values[$name] = $this->binaryDataReader->readUInt8() + 1900; |
422 | - } |
|
423 | - elseif ($column['type'] === ConstFieldType::ENUM) |
|
397 | + } elseif ($column['type'] === ConstFieldType::ENUM) |
|
424 | 398 | { |
425 | 399 | $value = $this->binaryDataReader->readUIntBySize($column['size']) - 1; |
426 | 400 | |
@@ -430,26 +404,21 @@ discard block |
||
430 | 404 | { |
431 | 405 | $values[$name] = $column['enum_values'][$value]; |
432 | 406 | } |
433 | - } |
|
434 | - elseif ($column['type'] === ConstFieldType::SET) |
|
407 | + } elseif ($column['type'] === ConstFieldType::SET) |
|
435 | 408 | { |
436 | 409 | $values[$name] = $this->getSet($column); |
437 | - } |
|
438 | - elseif ($column['type'] === ConstFieldType::BIT) |
|
410 | + } elseif ($column['type'] === ConstFieldType::BIT) |
|
439 | 411 | { |
440 | 412 | $values[$name] = $this->getBit($column); |
441 | - } |
|
442 | - elseif ($column['type'] === ConstFieldType::GEOMETRY) |
|
413 | + } elseif ($column['type'] === ConstFieldType::GEOMETRY) |
|
443 | 414 | { |
444 | 415 | $values[$name] = $this->binaryDataReader->readLengthCodedPascalString($column['length_size']); |
445 | - } |
|
446 | - elseif ($column['type'] === ConstFieldType::JSON) |
|
416 | + } elseif ($column['type'] === ConstFieldType::JSON) |
|
447 | 417 | { |
448 | 418 | $values[$name] = $this->jsonBinaryDecoderFactory->makeJsonBinaryDecoder( |
449 | 419 | $this->binaryDataReader->readLengthCodedPascalString($column['length_size']) |
450 | 420 | )->parseToString(); |
451 | - } |
|
452 | - else |
|
421 | + } else |
|
453 | 422 | { |
454 | 423 | throw new MySQLReplicationException('Unknown row type: ' . $column['type']); |
455 | 424 | } |
@@ -551,8 +520,7 @@ discard block |
||
551 | 520 | { |
552 | 521 | $mask = 0; |
553 | 522 | $res = ''; |
554 | - } |
|
555 | - else |
|
523 | + } else |
|
556 | 524 | { |
557 | 525 | $mask = -1; |
558 | 526 | $res = '-'; |
@@ -687,12 +655,10 @@ discard block |
||
687 | 655 | if ($column['fsp'] === 1 || $column['fsp'] === 2) |
688 | 656 | { |
689 | 657 | $read = 1; |
690 | - } |
|
691 | - elseif ($column['fsp'] === 3 || $column['fsp'] === 4) |
|
658 | + } elseif ($column['fsp'] === 3 || $column['fsp'] === 4) |
|
692 | 659 | { |
693 | 660 | $read = 2; |
694 | - } |
|
695 | - elseif ($column ['fsp'] === 5 || $column['fsp'] === 6) |
|
661 | + } elseif ($column ['fsp'] === 5 || $column['fsp'] === 6) |
|
696 | 662 | { |
697 | 663 | $read = 3; |
698 | 664 | } |
@@ -813,8 +779,7 @@ discard block |
||
813 | 779 | if (1 === $column['bytes']) |
814 | 780 | { |
815 | 781 | $end = $column['bits']; |
816 | - } |
|
817 | - else |
|
782 | + } else |
|
818 | 783 | { |
819 | 784 | $end = $column['bits'] % 8; |
820 | 785 | if (0 === $end) |
@@ -822,8 +787,7 @@ discard block |
||
822 | 787 | $end = 8; |
823 | 788 | } |
824 | 789 | } |
825 | - } |
|
826 | - else |
|
790 | + } else |
|
827 | 791 | { |
828 | 792 | $end = 8; |
829 | 793 | } |
@@ -833,8 +797,7 @@ discard block |
||
833 | 797 | if ($data & (1 << $bit)) |
834 | 798 | { |
835 | 799 | $current_byte .= '1'; |
836 | - } |
|
837 | - else |
|
800 | + } else |
|
838 | 801 | { |
839 | 802 | $current_byte .= '0'; |
840 | 803 | } |
@@ -94,20 +94,16 @@ discard block |
||
94 | 94 | if (self::SMALL_OBJECT === $type) |
95 | 95 | { |
96 | 96 | $this->parseObject(BinaryDataReader::UNSIGNED_SHORT_LENGTH); |
97 | - } |
|
98 | - else if (self::LARGE_OBJECT === $type) |
|
97 | + } else if (self::LARGE_OBJECT === $type) |
|
99 | 98 | { |
100 | 99 | $this->parseObject(BinaryDataReader::UNSIGNED_INT32_LENGTH); |
101 | - } |
|
102 | - else if (self::SMALL_ARRAY === $type) |
|
100 | + } else if (self::SMALL_ARRAY === $type) |
|
103 | 101 | { |
104 | 102 | $this->parseArray(BinaryDataReader::UNSIGNED_SHORT_LENGTH); |
105 | - } |
|
106 | - else if (self::LARGE_ARRAY === $type) |
|
103 | + } else if (self::LARGE_ARRAY === $type) |
|
107 | 104 | { |
108 | 105 | $this->parseObject(BinaryDataReader::UNSIGNED_INT32_LENGTH); |
109 | - } |
|
110 | - else |
|
106 | + } else |
|
111 | 107 | { |
112 | 108 | $this->parseScalar($type); |
113 | 109 | } |
@@ -175,24 +171,21 @@ discard block |
||
175 | 171 | $this->readLiteral(), |
176 | 172 | $type |
177 | 173 | ); |
178 | - } |
|
179 | - else if (self::INT16 === $type) |
|
174 | + } else if (self::INT16 === $type) |
|
180 | 175 | { |
181 | 176 | return new JsonBinaryDecoderValue( |
182 | 177 | true, |
183 | 178 | $this->binaryDataReader->readInt16(), |
184 | 179 | $type |
185 | 180 | ); |
186 | - } |
|
187 | - else if (self::UINT16 === $type) |
|
181 | + } else if (self::UINT16 === $type) |
|
188 | 182 | { |
189 | 183 | return new JsonBinaryDecoderValue( |
190 | 184 | true, |
191 | 185 | $this->binaryDataReader->readUInt16(), |
192 | 186 | $type |
193 | 187 | ); |
194 | - } |
|
195 | - else if (BinaryDataReader::UNSIGNED_INT32_LENGTH === $intSize) |
|
188 | + } else if (BinaryDataReader::UNSIGNED_INT32_LENGTH === $intSize) |
|
196 | 189 | { |
197 | 190 | if (self::INT32 === $type) |
198 | 191 | { |
@@ -201,8 +194,7 @@ discard block |
||
201 | 194 | $this->binaryDataReader->readInt32(), |
202 | 195 | $type |
203 | 196 | ); |
204 | - } |
|
205 | - else if (self::UINT32 === $type) |
|
197 | + } else if (self::UINT32 === $type) |
|
206 | 198 | { |
207 | 199 | return new JsonBinaryDecoderValue( |
208 | 200 | true, |
@@ -210,8 +202,7 @@ discard block |
||
210 | 202 | $type |
211 | 203 | ); |
212 | 204 | } |
213 | - } |
|
214 | - else |
|
205 | + } else |
|
215 | 206 | { |
216 | 207 | $offset = $this->binaryDataReader->readUIntBySize($intSize); |
217 | 208 | if ($offset > $numBytes) |
@@ -242,12 +233,10 @@ discard block |
||
242 | 233 | if (0 === $literal) |
243 | 234 | { |
244 | 235 | return null; |
245 | - } |
|
246 | - else if (1 === $literal) |
|
236 | + } else if (1 === $literal) |
|
247 | 237 | { |
248 | 238 | return true; |
249 | - } |
|
250 | - else if (2 === $literal) |
|
239 | + } else if (2 === $literal) |
|
251 | 240 | { |
252 | 241 | return false; |
253 | 242 | } |
@@ -263,18 +252,15 @@ discard block |
||
263 | 252 | if (false === $jsonBinaryDecoderValue->isIsResolved()) |
264 | 253 | { |
265 | 254 | $this->parseJson($jsonBinaryDecoderValue->getType()); |
266 | - } |
|
267 | - else |
|
255 | + } else |
|
268 | 256 | { |
269 | 257 | if (null === $jsonBinaryDecoderValue->getValue()) |
270 | 258 | { |
271 | 259 | $this->jsonBinaryDecoderFormatter->formatValueNull(); |
272 | - } |
|
273 | - elseif (is_bool($jsonBinaryDecoderValue->getValue())) |
|
260 | + } elseif (is_bool($jsonBinaryDecoderValue->getValue())) |
|
274 | 261 | { |
275 | 262 | $this->jsonBinaryDecoderFormatter->formatValueBool($jsonBinaryDecoderValue->getValue()); |
276 | - } |
|
277 | - elseif (is_numeric($jsonBinaryDecoderValue->getValue())) |
|
263 | + } elseif (is_numeric($jsonBinaryDecoderValue->getValue())) |
|
278 | 264 | { |
279 | 265 | $this->jsonBinaryDecoderFormatter->formatValueNumeric($jsonBinaryDecoderValue->getValue()); |
280 | 266 | } |
@@ -314,8 +300,7 @@ discard block |
||
314 | 300 | if (null === $r) |
315 | 301 | { |
316 | 302 | $this->jsonBinaryDecoderFormatter->formatValueNull(); |
317 | - } |
|
318 | - else |
|
303 | + } else |
|
319 | 304 | { |
320 | 305 | $this->jsonBinaryDecoderFormatter->formatValueBool($r); |
321 | 306 | } |
@@ -326,32 +311,25 @@ discard block |
||
326 | 311 | if (self::LITERAL === $type) |
327 | 312 | { |
328 | 313 | $this->parseBoolean(); |
329 | - } |
|
330 | - else if (self::INT16 === $type) |
|
314 | + } else if (self::INT16 === $type) |
|
331 | 315 | { |
332 | 316 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readInt16()); |
333 | - } |
|
334 | - else if (self::INT32 === $type) |
|
317 | + } else if (self::INT32 === $type) |
|
335 | 318 | { |
336 | 319 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readInt32()); |
337 | - } |
|
338 | - else if (self::INT64 === $type) |
|
320 | + } else if (self::INT64 === $type) |
|
339 | 321 | { |
340 | 322 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readInt64()); |
341 | - } |
|
342 | - else if (self::UINT16 === $type) |
|
323 | + } else if (self::UINT16 === $type) |
|
343 | 324 | { |
344 | 325 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readUInt16()); |
345 | - } |
|
346 | - else if (self::UINT64 === $type) |
|
326 | + } else if (self::UINT64 === $type) |
|
347 | 327 | { |
348 | 328 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readUInt64()); |
349 | - } |
|
350 | - else if (self::DOUBLE === $type) |
|
329 | + } else if (self::DOUBLE === $type) |
|
351 | 330 | { |
352 | 331 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readDouble()); |
353 | - } |
|
354 | - else if (self::STRING === $type) |
|
332 | + } else if (self::STRING === $type) |
|
355 | 333 | { |
356 | 334 | $this->jsonBinaryDecoderFormatter->formatValue( |
357 | 335 | $this->binaryDataReader->read($this->readVariableInt()) |