Code Duplication    Length = 8-8 lines in 4 locations

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

@@ 198-205 (lines=8) @@
195
     * @param string $streamId
196
     * @return int
197
     */
198
    protected function streamVersion($streamId)
199
    {
200
        $stmt = $this->connection
201
            ->prepare('SELECT COUNT(*) FROM events WHERE stream_id = :streamId');
202
        $stmt->bindValue(':streamId', $streamId);
203
        $stmt->execute();
204
        return intval($stmt->fetchColumn());
205
    }
206
207
    /**
208
     * @param string $streamId
@@ 234-241 (lines=8) @@
231
     * @param string $streamId
232
     * @return bool
233
     */
234
    protected function streamExists($streamId)
235
    {
236
        $stmt = $this->connection
237
            ->prepare('SELECT COUNT(*) FROM streams WHERE id = :streamId');
238
        $stmt->bindValue(':streamId', $streamId);
239
        $stmt->execute();
240
        return boolval($stmt->fetchColumn());
241
    }
242
243
    /**
244
     * Initialize the Event Store

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

@@ 185-192 (lines=8) @@
182
     * @param string $streamId
183
     * @return int
184
     */
185
    protected function streamVersion($streamId)
186
    {
187
        $stmt = $this->connection
188
            ->prepare('SELECT COUNT(*) FROM events WHERE stream_id = :streamId');
189
        $stmt->bindValue(':streamId', $streamId);
190
        $stmt->execute();
191
        return intval($stmt->fetchColumn());
192
    }
193
194
    /**
195
     * @param string $type
@@ 173-180 (lines=8) @@
170
     * @param string $streamId
171
     * @return bool
172
     */
173
    protected function streamExists($streamId)
174
    {
175
        $stmt = $this->connection
176
            ->prepare('SELECT COUNT(*) FROM streams WHERE id = :streamId');
177
        $stmt->bindValue(':streamId', $streamId);
178
        $stmt->execute();
179
        return boolval($stmt->fetchColumn());
180
    }
181
    /**
182
     * @param string $streamId
183
     * @return int