Code Duplication    Length = 8-8 lines in 4 locations

src/EventSourcing/EventStore/Vendor/DoctrineDbalEventStore.php 2 locations

@@ 227-234 (lines=8) @@
224
     * @param string $streamId
225
     * @return int
226
     */
227
    protected function streamVersion($streamId)
228
    {
229
        $stmt = $this->connection
230
            ->prepare('SELECT COUNT(*) FROM events WHERE stream_id = :streamId');
231
        $stmt->bindValue(':streamId', $streamId);
232
        $stmt->execute();
233
        return intval($stmt->fetchColumn());
234
    }
235
236
    /**
237
     * @param string $streamId
@@ 263-270 (lines=8) @@
260
     * @param string $streamId
261
     * @return bool
262
     */
263
    protected function streamExists($streamId)
264
    {
265
        $stmt = $this->connection
266
            ->prepare('SELECT COUNT(*) FROM streams WHERE id = :streamId');
267
        $stmt->bindValue(':streamId', $streamId);
268
        $stmt->execute();
269
        return boolval($stmt->fetchColumn());
270
    }
271
272
    /**
273
     * Initialize the Event Store

src/EventSourcing/EventStore/Vendor/MySqlJsonEventStore.php 2 locations

@@ 202-209 (lines=8) @@
199
     * @param string $streamId
200
     * @return bool
201
     */
202
    protected function streamExists($streamId)
203
    {
204
        $stmt = $this->connection
205
            ->prepare('SELECT COUNT(*) FROM streams WHERE id = :streamId');
206
        $stmt->bindValue(':streamId', $streamId);
207
        $stmt->execute();
208
        return boolval($stmt->fetchColumn());
209
    }
210
    /**
211
     * @param string $streamId
212
     * @return int
@@ 214-221 (lines=8) @@
211
     * @param string $streamId
212
     * @return int
213
     */
214
    protected function streamVersion($streamId)
215
    {
216
        $stmt = $this->connection
217
            ->prepare('SELECT COUNT(*) FROM events WHERE stream_id = :streamId');
218
        $stmt->bindValue(':streamId', $streamId);
219
        $stmt->execute();
220
        return intval($stmt->fetchColumn());
221
    }
222
223
    /**
224
     * @param string $type