@@ -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) |
@@ -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); |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | 'host' => $config->getIp(), |
| 76 | 76 | 'port' => $config->getPort(), |
| 77 | 77 | 'driver' => 'pdo_mysql', |
| 78 | - 'charset' => $config->getCharset() |
|
| 78 | + 'charset' => $config->getCharset() |
|
| 79 | 79 | ]); |
| 80 | 80 | $this->binLogAuth = new BinLogAuth(); |
| 81 | 81 | $this->MySQLRepository = new MySQLRepository($this->connection); |