Code Duplication    Length = 12-13 lines in 3 locations

src/ZohoDatabasePusher.php 3 locations

@@ 117-128 (lines=12) @@
114
                            ]);
115
                        $record = $recordQuery->execute()->fetch();
116
117
                        if (!$record) {
118
                            $errorMessage = sprintf('Impossible to find row with uid %s in the table %s', $result['uid'], $tableName);
119
                            $this->logger->warning($errorMessage);
120
                            $this->connection->update($localTable, [
121
                                'error' => $errorMessage,
122
                                'errorTime' => date('Y-m-d H:i:s'),
123
                            ], [
124
                                'uid' => $result['uid'],
125
                                'table_name' => $tableName
126
                            ]);
127
                            continue;
128
                        }
129
130
                        if (isset($zohoBeans[$record['uid']])) {
131
                            $zohoBean = $zohoBeans[$record['uid']];
@@ 157-169 (lines=13) @@
154
                            $columnName = $fieldResults['field_name'];
155
                            if (array_key_exists($columnName, $record)) {
156
                                $this->updateDataZohoBean($zohoDao, $zohoBean, $columnName, $record[$columnName]);
157
                            } else {
158
                                $errorMessage = sprintf('Impossible to find the column %s for row with uid %s in the table %s', $columnName, $result['uid'], $tableName);
159
                                $this->logger->warning($errorMessage);
160
                                $this->connection->update($localTable, [
161
                                    'error' => $errorMessage,
162
                                    'errorTime' => date('Y-m-d H:i:s'),
163
                                ], [
164
                                    'uid' => $result['uid'],
165
                                    'table_name' => $tableName,
166
                                    'field_name' => $columnName
167
                                ]);
168
                                continue;
169
                            }
170
                        }
171
172
                        $this->logger->debug(sprintf('Updated row %s (id: \'%s\') from table %s added in queue to be pushed.', $record['uid'], $record['id'], $tableName));
@@ 200-211 (lines=12) @@
197
                            ]);
198
                        $record = $recordQuery->execute()->fetch();
199
200
                        if (!$record) {
201
                            $errorMessage = sprintf('Impossible to find row with uid %s in the table %s', $result['uid'], $tableName);
202
                            $this->logger->warning($errorMessage);
203
                            $this->connection->update($localTable, [
204
                                'error' => $errorMessage,
205
                                'errorTime' => date('Y-m-d H:i:s'),
206
                            ], [
207
                                'uid' => $result['uid'],
208
                                'table_name' => $tableName
209
                            ]);
210
                            continue;
211
                        }
212
213
                        if (isset($zohoBeans[$record['uid']])) {
214
                            $zohoBean = $zohoBeans[$record['uid']];