Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 55-63 (lines=9) @@
52
     *
53
     * @param integer $timeout Timeout (ms) for acknowledged index creation
54
     */
55
    public function ensureIndexes($timeout = null)
56
    {
57
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
58
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
59
                continue;
60
            }
61
            $this->ensureDocumentIndexes($class->name, $timeout);
62
        }
63
    }
64
65
    /**
66
     * Ensure indexes exist for all mapped document classes.
@@ 73-81 (lines=9) @@
70
     *
71
     * @param integer $timeout Timeout (ms) for acknowledged index creation
72
     */
73
    public function updateIndexes($timeout = null)
74
    {
75
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
76
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
77
                continue;
78
            }
79
            $this->updateDocumentIndexes($class->name, $timeout);
80
        }
81
    }
82
83
    /**
84
     * Ensure indexes exist for the mapped document class.
@@ 279-287 (lines=9) @@
276
     * Delete indexes for all documents that can be loaded with the
277
     * metadata factory.
278
     */
279
    public function deleteIndexes()
280
    {
281
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
282
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
283
                continue;
284
            }
285
            $this->deleteDocumentIndexes($class->name);
286
        }
287
    }
288
289
    /**
290
     * Delete the given document's indexes.
@@ 307-315 (lines=9) @@
304
    /**
305
     * Create all the mapped document collections in the metadata factory.
306
     */
307
    public function createCollections()
308
    {
309
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
310
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
311
                continue;
312
            }
313
            $this->createDocumentCollection($class->name);
314
        }
315
    }
316
317
    /**
318
     * Create the document collection for a mapped class.
@@ 349-357 (lines=9) @@
346
    /**
347
     * Drop all the mapped document collections in the metadata factory.
348
     */
349
    public function dropCollections()
350
    {
351
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
352
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
353
                continue;
354
            }
355
            $this->dropDocumentCollection($class->name);
356
        }
357
    }
358
359
    /**
360
     * Drop the document collection for a mapped class.
@@ 377-385 (lines=9) @@
374
    /**
375
     * Drop all the mapped document databases in the metadata factory.
376
     */
377
    public function dropDatabases()
378
    {
379
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
380
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
381
                continue;
382
            }
383
            $this->dropDocumentDatabase($class->name);
384
        }
385
    }
386
387
    /**
388
     * Drop the document database for a mapped class.