Code Duplication    Length = 12-13 lines in 3 locations

src/ZohoDatabasePusher.php 3 locations

@@ 129-140 (lines=12) @@
126
                            ]);
127
                        $record = $recordQuery->execute()->fetch();
128
129
                        if (!$record) {
130
                            $errorMessage = sprintf('Impossible to find row with uid %s in the table %s', $result['uid'], $tableName);
131
                            $this->logger->warning($errorMessage);
132
                            $this->connection->update($localTable, [
133
                                'error' => $errorMessage,
134
                                'errorTime' => date('Y-m-d H:i:s'),
135
                            ], [
136
                                'uid' => $result['uid'],
137
                                'table_name' => $tableName
138
                            ]);
139
                            continue;
140
                        }
141
142
                        if (isset($zohoBeans[$record['uid']])) {
143
                            $zohoBean = $zohoBeans[$record['uid']];
@@ 171-183 (lines=13) @@
168
                            if (array_key_exists($columnName, $record)) {
169
                                $this->updateDataZohoBean($zohoDao, $zohoBean, $columnName, $record[$columnName]);
170
                                $previousValues[$columnName] = $fieldResults['previous_value'];
171
                            } else {
172
                                $errorMessage = sprintf('Impossible to find the column %s for row with uid %s in the table %s', $columnName, $result['uid'], $tableName);
173
                                $this->logger->warning($errorMessage);
174
                                $this->connection->update($localTable, [
175
                                    'error' => $errorMessage,
176
                                    'errorTime' => date('Y-m-d H:i:s'),
177
                                ], [
178
                                    'uid' => $result['uid'],
179
                                    'table_name' => $tableName,
180
                                    'field_name' => $columnName
181
                                ]);
182
                                continue;
183
                            }
184
                        }
185
186
                        $this->logger->debug(sprintf('Updated row %s (id: \'%s\') from table %s added in queue to be pushed.', $record['uid'], $record['id'], $tableName));
@@ 216-227 (lines=12) @@
213
                            ]);
214
                        $record = $recordQuery->execute()->fetch();
215
216
                        if (!$record) {
217
                            $errorMessage = sprintf('Impossible to find row with uid %s in the table %s', $result['uid'], $tableName);
218
                            $this->logger->warning($errorMessage);
219
                            $this->connection->update($localTable, [
220
                                'error' => $errorMessage,
221
                                'errorTime' => date('Y-m-d H:i:s'),
222
                            ], [
223
                                'uid' => $result['uid'],
224
                                'table_name' => $tableName
225
                            ]);
226
                            continue;
227
                        }
228
229
                        if (isset($zohoBeans[$record['uid']])) {
230
                            $zohoBean = $zohoBeans[$record['uid']];