Code Duplication    Length = 20-20 lines in 2 locations

src/ConnectionTrait.php 2 locations

@@ 98-117 (lines=20) @@
95
        $stmt = null;
96
        $attempt = 0;
97
        $retry = true;
98
        while ($retry) {
99
            $retry = false;
100
101
            try {
102
                $stmt = parent::executeQuery($query, $params, $types, $qcp);
103
            } catch (Throwable $e) {
104
                if ($this->canTryAgain($attempt) && $this->isRetryableException($e, $query)) {
105
                    $this->close();
106
                    ++$attempt;
107
                    $retry = true;
108
109
                    $this->getEventManager()->dispatchEvent(
110
                        Events\Events::RECONNECT_TO_DATABASE,
111
                        new ReconnectEventArgs(__FUNCTION__, $attempt, $query)
112
                    );
113
                }
114
115
                throw $e;
116
            }
117
        }
118
119
        return $stmt;
120
    }
@@ 190-209 (lines=20) @@
187
        $stmt = null;
188
        $attempt = 0;
189
        $retry = true;
190
        while ($retry) {
191
            $retry = false;
192
193
            try {
194
                $stmt = parent::executeUpdate($query, $params, $types);
195
            } catch (Throwable $e) {
196
                if ($this->canTryAgain($attempt) && $this->isRetryableException($e)) {
197
                    $this->close();
198
                    ++$attempt;
199
                    $retry = true;
200
201
                    $this->getEventManager()->dispatchEvent(
202
                        Events\Events::RECONNECT_TO_DATABASE,
203
                        new ReconnectEventArgs(__FUNCTION__, $attempt, $query)
204
                    );
205
                } else {
206
                    throw $e;
207
                }
208
            }
209
        }
210
211
        return $stmt;
212
    }