Code Duplication    Length = 9-9 lines in 7 locations

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

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