@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @param $length |
| 143 | - * @return mixed |
|
| 143 | + * @return string |
|
| 144 | 144 | * @throws BinLogException |
| 145 | 145 | */ |
| 146 | 146 | private function readFromSocket($length) |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * @param $packet |
|
| 164 | + * @param string $packet |
|
| 165 | 165 | * @return array |
| 166 | 166 | * @throws BinLogException |
| 167 | 167 | */ |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | - * @param $data |
|
| 206 | + * @param string $data |
|
| 207 | 207 | * @throws BinLogException |
| 208 | 208 | */ |
| 209 | 209 | private function writeToSocket($data) |
@@ -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 | } |
@@ -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 | } |
@@ -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()) { |
@@ -352,9 +352,9 @@ |
||
| 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); |
@@ -162,8 +162,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -94,20 +94,16 @@ discard block |
||
| 94 | 94 | if (self::SMALL_OBJECT === $type) |
| 95 | 95 | { |
| 96 | 96 | $this->parseObject(); |
| 97 | - } |
|
| 98 | - else if (self::LARGE_OBJECT === $type) |
|
| 97 | + } else if (self::LARGE_OBJECT === $type) |
|
| 99 | 98 | { |
| 100 | 99 | //TODO |
| 101 | - } |
|
| 102 | - else if (self::SMALL_ARRAY === $type) |
|
| 100 | + } else if (self::SMALL_ARRAY === $type) |
|
| 103 | 101 | { |
| 104 | 102 | $this->parseArray(); |
| 105 | - } |
|
| 106 | - else if (self::LARGE_ARRAY === $type) |
|
| 103 | + } else if (self::LARGE_ARRAY === $type) |
|
| 107 | 104 | { |
| 108 | 105 | //TODO |
| 109 | - } |
|
| 110 | - else |
|
| 106 | + } else |
|
| 111 | 107 | { |
| 112 | 108 | $this->parseScalar($type); |
| 113 | 109 | } |
@@ -174,40 +170,35 @@ discard block |
||
| 174 | 170 | $this->readLiteral(), |
| 175 | 171 | $type |
| 176 | 172 | ); |
| 177 | - } |
|
| 178 | - else if (self::INT16 === $type) |
|
| 173 | + } else if (self::INT16 === $type) |
|
| 179 | 174 | { |
| 180 | 175 | return new JsonBinaryDecoderValue( |
| 181 | 176 | true, |
| 182 | 177 | $this->binaryDataReader->readInt16(), |
| 183 | 178 | $type |
| 184 | 179 | ); |
| 185 | - } |
|
| 186 | - else if (self::UINT16 === $type) |
|
| 180 | + } else if (self::UINT16 === $type) |
|
| 187 | 181 | { |
| 188 | 182 | return new JsonBinaryDecoderValue( |
| 189 | 183 | true, |
| 190 | 184 | $this->binaryDataReader->readUInt16(), |
| 191 | 185 | $type |
| 192 | 186 | ); |
| 193 | - } |
|
| 194 | - else if (self::INT32 === $type) |
|
| 187 | + } else if (self::INT32 === $type) |
|
| 195 | 188 | { |
| 196 | 189 | return new JsonBinaryDecoderValue( |
| 197 | 190 | true, |
| 198 | 191 | $this->binaryDataReader->readInt32(), |
| 199 | 192 | $type |
| 200 | 193 | ); |
| 201 | - } |
|
| 202 | - else if (self::UINT32 === $type) |
|
| 194 | + } else if (self::UINT32 === $type) |
|
| 203 | 195 | { |
| 204 | 196 | return new JsonBinaryDecoderValue( |
| 205 | 197 | true, |
| 206 | 198 | $this->binaryDataReader->readUInt32(), |
| 207 | 199 | $type |
| 208 | 200 | ); |
| 209 | - } |
|
| 210 | - else |
|
| 201 | + } else |
|
| 211 | 202 | { |
| 212 | 203 | $offset = $this->binaryDataReader->readUInt16(); |
| 213 | 204 | if ($offset > $numBytes) |
@@ -238,12 +229,10 @@ discard block |
||
| 238 | 229 | if (0 === $literal) |
| 239 | 230 | { |
| 240 | 231 | return null; |
| 241 | - } |
|
| 242 | - else if (1 === $literal) |
|
| 232 | + } else if (1 === $literal) |
|
| 243 | 233 | { |
| 244 | 234 | return true; |
| 245 | - } |
|
| 246 | - else if (2 === $literal) |
|
| 235 | + } else if (2 === $literal) |
|
| 247 | 236 | { |
| 248 | 237 | return false; |
| 249 | 238 | } |
@@ -259,18 +248,15 @@ discard block |
||
| 259 | 248 | if (false === $jsonBinaryDecoderValue->isIsResolved()) |
| 260 | 249 | { |
| 261 | 250 | $this->parseJson($jsonBinaryDecoderValue->getType()); |
| 262 | - } |
|
| 263 | - else |
|
| 251 | + } else |
|
| 264 | 252 | { |
| 265 | 253 | if (null === $jsonBinaryDecoderValue->getValue()) |
| 266 | 254 | { |
| 267 | 255 | $this->jsonBinaryDecoderFormatter->formatValueNull(); |
| 268 | - } |
|
| 269 | - elseif (is_bool($jsonBinaryDecoderValue->getValue())) |
|
| 256 | + } elseif (is_bool($jsonBinaryDecoderValue->getValue())) |
|
| 270 | 257 | { |
| 271 | 258 | $this->jsonBinaryDecoderFormatter->formatValueBool($jsonBinaryDecoderValue->getValue()); |
| 272 | - } |
|
| 273 | - elseif (is_numeric($jsonBinaryDecoderValue->getValue())) |
|
| 259 | + } elseif (is_numeric($jsonBinaryDecoderValue->getValue())) |
|
| 274 | 260 | { |
| 275 | 261 | $this->jsonBinaryDecoderFormatter->formatValueNumeric($jsonBinaryDecoderValue->getValue()); |
| 276 | 262 | } |
@@ -310,8 +296,7 @@ discard block |
||
| 310 | 296 | if (null === $r) |
| 311 | 297 | { |
| 312 | 298 | $this->jsonBinaryDecoderFormatter->formatValueNull(); |
| 313 | - } |
|
| 314 | - else |
|
| 299 | + } else |
|
| 315 | 300 | { |
| 316 | 301 | $this->jsonBinaryDecoderFormatter->formatValueBool($r); |
| 317 | 302 | } |
@@ -322,32 +307,25 @@ discard block |
||
| 322 | 307 | if (self::LITERAL === $type) |
| 323 | 308 | { |
| 324 | 309 | $this->parseBoolean(); |
| 325 | - } |
|
| 326 | - else if (self::INT16 === $type) |
|
| 310 | + } else if (self::INT16 === $type) |
|
| 327 | 311 | { |
| 328 | 312 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readInt16()); |
| 329 | - } |
|
| 330 | - else if (self::INT32 === $type) |
|
| 313 | + } else if (self::INT32 === $type) |
|
| 331 | 314 | { |
| 332 | 315 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readInt32()); |
| 333 | - } |
|
| 334 | - else if (self::INT64 === $type) |
|
| 316 | + } else if (self::INT64 === $type) |
|
| 335 | 317 | { |
| 336 | 318 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readInt64()); |
| 337 | - } |
|
| 338 | - else if (self::UINT16 === $type) |
|
| 319 | + } else if (self::UINT16 === $type) |
|
| 339 | 320 | { |
| 340 | 321 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readUInt16()); |
| 341 | - } |
|
| 342 | - else if (self::UINT64 === $type) |
|
| 322 | + } else if (self::UINT64 === $type) |
|
| 343 | 323 | { |
| 344 | 324 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readUInt64()); |
| 345 | - } |
|
| 346 | - else if (self::DOUBLE === $type) |
|
| 325 | + } else if (self::DOUBLE === $type) |
|
| 347 | 326 | { |
| 348 | 327 | $this->jsonBinaryDecoderFormatter->formatValue($this->binaryDataReader->readDouble()); |
| 349 | - } |
|
| 350 | - else if (self::STRING === $type) |
|
| 328 | + } else if (self::STRING === $type) |
|
| 351 | 329 | { |
| 352 | 330 | $this->jsonBinaryDecoderFormatter->formatValue( |
| 353 | 331 | $this->binaryDataReader->read($this->readVariableInt()) |