@@ -152,7 +152,7 @@ |
||
152 | 152 | { |
153 | 153 | $retryNum = $this->config->getRetry(); |
154 | 154 | while (1) { |
155 | - if (! $this->socket->isConnected()) { |
|
155 | + if (!$this->socket->isConnected()) { |
|
156 | 156 | try { |
157 | 157 | if ($retryNum) { |
158 | 158 | $retryNum--; |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function validate(): void |
73 | 73 | { |
74 | - if (! empty($this->host)) { |
|
74 | + if (!empty($this->host)) { |
|
75 | 75 | $ip = gethostbyname($this->host); |
76 | 76 | if (false === filter_var($ip, FILTER_VALIDATE_IP)) { |
77 | 77 | throw new ConfigException(ConfigException::IP_ERROR_MESSAGE, ConfigException::IP_ERROR_CODE); |
78 | 78 | } |
79 | 79 | } |
80 | - if (! empty($this->port) && false === filter_var( |
|
80 | + if (!empty($this->port) && false === filter_var( |
|
81 | 81 | $this->port, |
82 | 82 | FILTER_VALIDATE_INT, |
83 | 83 | ['options' => ['min_range' => 0]] |
84 | 84 | )) { |
85 | 85 | throw new ConfigException(ConfigException::PORT_ERROR_MESSAGE, ConfigException::PORT_ERROR_CODE); |
86 | 86 | } |
87 | - if (! empty($this->gtid)) { |
|
87 | + if (!empty($this->gtid)) { |
|
88 | 88 | foreach (explode(',', $this->gtid) as $gtid) { |
89 | - if (! (bool)preg_match( |
|
89 | + if (!(bool)preg_match( |
|
90 | 90 | '/^([0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})((?::[0-9-]+)+)$/', |
91 | 91 | $gtid, |
92 | 92 | $matches |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | - if (! empty($this->slaveId) && false === filter_var( |
|
98 | + if (!empty($this->slaveId) && false === filter_var( |
|
99 | 99 | $this->slaveId, |
100 | 100 | FILTER_VALIDATE_INT, |
101 | 101 | ['options' => ['min_range' => 0]] |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | public function checkDataBasesOnly(string $database): bool |
188 | 188 | { |
189 | - return [] !== $this->getDatabasesOnly() && ! self::matchNames($database, $this->getDatabasesOnly()); |
|
189 | + return [] !== $this->getDatabasesOnly() && !self::matchNames($database, $this->getDatabasesOnly()); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | public function getDatabasesOnly(): array |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | public function checkTablesOnly(string $table): bool |
198 | 198 | { |
199 | - return [] !== $this->getTablesOnly() && ! self::matchNames($table, $this->getTablesOnly()); |
|
199 | + return [] !== $this->getTablesOnly() && !self::matchNames($table, $this->getTablesOnly()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | private static function matchNames(string $subject, array $names): bool |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | public function checkEvent(int $type): bool |
219 | 219 | { |
220 | - if ([] !== $this->getEventsOnly() && ! in_array($type, $this->getEventsOnly(), true)) { |
|
220 | + if ([] !== $this->getEventsOnly() && !in_array($type, $this->getEventsOnly(), true)) { |
|
221 | 221 | return false; |
222 | 222 | } |
223 | 223 |
@@ -113,7 +113,7 @@ |
||
113 | 113 | private function isWriteSuccessful(string $data): void |
114 | 114 | { |
115 | 115 | $head = ord($data[0]); |
116 | - if (! in_array($head, $this->packageOkHeader, true)) { |
|
116 | + if (!in_array($head, $this->packageOkHeader, true)) { |
|
117 | 117 | $errorCode = unpack('v', $data[1] . $data[2])[1]; |
118 | 118 | $errorMessage = ''; |
119 | 119 | $packetLength = strlen($data); |
@@ -289,7 +289,7 @@ |
||
289 | 289 | |
290 | 290 | public function isComplete(int $size): bool |
291 | 291 | { |
292 | - return ! ($this->readBytes - 20 < $size); |
|
292 | + return !($this->readBytes - 20 < $size); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | public function getBinaryDataLength(): int |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function connectToStream(string $host, int $port): void |
30 | 30 | { |
31 | 31 | $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
32 | - if (! $this->socket) { |
|
32 | + if (!$this->socket) { |
|
33 | 33 | throw new SocketException( |
34 | 34 | SocketException::SOCKET_UNABLE_TO_CREATE_MESSAGE . $this->getSocketErrorMessage(), |
35 | 35 | SocketException::SOCKET_UNABLE_TO_CREATE_CODE |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | socket_set_block($this->socket); |
39 | 39 | socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
40 | 40 | |
41 | - if (! socket_connect($this->socket, $host, $port)) { |
|
41 | + if (!socket_connect($this->socket, $host, $port)) { |
|
42 | 42 | throw new SocketException($this->getSocketErrorMessage(), $this->getSocketErrorCode()); |
43 | 43 | } |
44 | 44 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | public function writeToSocket(string $data): void |
75 | 75 | { |
76 | - if (! socket_write($this->socket, $data, strlen($data))) { |
|
76 | + if (!socket_write($this->socket, $data, strlen($data))) { |
|
77 | 77 | throw new SocketException( |
78 | 78 | SocketException::SOCKET_UNABLE_TO_WRITE_MESSAGE . $this->getSocketErrorMessage(), |
79 | 79 | SocketException::SOCKET_UNABLE_TO_WRITE_CODE |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $fieldDTOCollection = $this->repository->getFields($data['schema_name'], $data['table_name']); |
352 | 352 | $columnDTOCollection = new ColumnDTOCollection(); |
353 | 353 | // if you drop tables and parse of logs you will get empty scheme |
354 | - if (! $fieldDTOCollection->isEmpty()) { |
|
354 | + if (!$fieldDTOCollection->isEmpty()) { |
|
355 | 355 | $columnLength = strlen($data['column_types']); |
356 | 356 | for ($offset = 0; $offset < $columnLength; ++$offset) { |
357 | 357 | // this a dirty hack to prevent row events containing columns which have been dropped |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function makeWriteRowsDTO(): ?WriteRowsDTO |
393 | 393 | { |
394 | - if (! $this->rowInit()) { |
|
394 | + if (!$this->rowInit()) { |
|
395 | 395 | return null; |
396 | 396 | } |
397 | 397 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | ); |
456 | 456 | |
457 | 457 | $values = []; |
458 | - while (! $this->binaryDataReader->isComplete($this->eventInfo->getSizeNoHeader())) { |
|
458 | + while (!$this->binaryDataReader->isComplete($this->eventInfo->getSizeNoHeader())) { |
|
459 | 459 | $values[] = $this->getColumnData($binaryData); |
460 | 460 | } |
461 | 461 | |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | */ |
895 | 895 | public function makeDeleteRowsDTO(): ?DeleteRowsDTO |
896 | 896 | { |
897 | - if (! $this->rowInit()) { |
|
897 | + if (!$this->rowInit()) { |
|
898 | 898 | return null; |
899 | 899 | } |
900 | 900 | |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | */ |
917 | 917 | public function makeUpdateRowsDTO(): ?UpdateRowsDTO |
918 | 918 | { |
919 | - if (! $this->rowInit()) { |
|
919 | + if (!$this->rowInit()) { |
|
920 | 920 | return null; |
921 | 921 | } |
922 | 922 | |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | $afterBinaryData = $this->binaryDataReader->read($columnsBinarySize); |
926 | 926 | |
927 | 927 | $values = []; |
928 | - while (! $this->binaryDataReader->isComplete($this->eventInfo->getSizeNoHeader())) { |
|
928 | + while (!$this->binaryDataReader->isComplete($this->eventInfo->getSizeNoHeader())) { |
|
929 | 929 | $values[] = [ |
930 | 930 | 'before' => $this->getColumnData($beforeBinaryData), |
931 | 931 | 'after' => $this->getColumnData($afterBinaryData) |
@@ -186,7 +186,7 @@ |
||
186 | 186 | |
187 | 187 | public function isUnsigned(): bool |
188 | 188 | { |
189 | - return ! (stripos($this->fieldDTO->getColumnType(), 'unsigned') === false); |
|
189 | + return !(stripos($this->fieldDTO->getColumnType(), 'unsigned') === false); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | public function isPrimary(): bool |
@@ -93,7 +93,7 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | // check for ignore and permitted events |
96 | - if (! $this->config->checkEvent($eventInfo->getType())) { |
|
96 | + if (!$this->config->checkEvent($eventInfo->getType())) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 |