Code Duplication    Length = 9-9 lines in 6 locations

lib/Doctrine/ODM/MongoDB/SchemaManager.php 6 locations

@@ 41-49 (lines=9) @@
38
     *
39
     * @param int $timeout Timeout (ms) for acknowledged index creation
40
     */
41
    public function ensureIndexes($timeout = null)
42
    {
43
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
44
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
45
                continue;
46
            }
47
            $this->ensureDocumentIndexes($class->name, $timeout);
48
        }
49
    }
50
51
    /**
52
     * Ensure indexes exist for all mapped document classes.
@@ 59-67 (lines=9) @@
56
     *
57
     * @param int $timeout Timeout (ms) for acknowledged index creation
58
     */
59
    public function updateIndexes($timeout = null)
60
    {
61
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
62
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
63
                continue;
64
            }
65
            $this->updateDocumentIndexes($class->name, $timeout);
66
        }
67
    }
68
69
    /**
70
     * Ensure indexes exist for the mapped document class.
@@ 253-261 (lines=9) @@
250
     * Delete indexes for all documents that can be loaded with the
251
     * metadata factory.
252
     */
253
    public function deleteIndexes()
254
    {
255
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
256
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
257
                continue;
258
            }
259
            $this->deleteDocumentIndexes($class->name);
260
        }
261
    }
262
263
    /**
264
     * Delete the given document's indexes.
@@ 281-289 (lines=9) @@
278
    /**
279
     * Create all the mapped document collections in the metadata factory.
280
     */
281
    public function createCollections()
282
    {
283
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
284
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
285
                continue;
286
            }
287
            $this->createDocumentCollection($class->name);
288
        }
289
    }
290
291
    /**
292
     * Create the document collection for a mapped class.
@@ 318-326 (lines=9) @@
315
    /**
316
     * Drop all the mapped document collections in the metadata factory.
317
     */
318
    public function dropCollections()
319
    {
320
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
321
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
322
                continue;
323
            }
324
            $this->dropDocumentCollection($class->name);
325
        }
326
    }
327
328
    /**
329
     * Drop the document collection for a mapped class.
@@ 346-354 (lines=9) @@
343
    /**
344
     * Drop all the mapped document databases in the metadata factory.
345
     */
346
    public function dropDatabases()
347
    {
348
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
349
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
350
                continue;
351
            }
352
            $this->dropDocumentDatabase($class->name);
353
        }
354
    }
355
356
    /**
357
     * Drop the document database for a mapped class.