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.
@@ 284-292 (lines=9) @@
281
     * Delete indexes for all documents that can be loaded with the
282
     * metadata factory.
283
     */
284
    public function deleteIndexes()
285
    {
286
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
287
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
288
                continue;
289
            }
290
            $this->deleteDocumentIndexes($class->name);
291
        }
292
    }
293
294
    /**
295
     * Delete the given document's indexes.
@@ 312-320 (lines=9) @@
309
    /**
310
     * Create all the mapped document collections in the metadata factory.
311
     */
312
    public function createCollections()
313
    {
314
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
315
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
316
                continue;
317
            }
318
            $this->createDocumentCollection($class->name);
319
        }
320
    }
321
322
    /**
323
     * Create the document collection for a mapped class.
@@ 354-362 (lines=9) @@
351
    /**
352
     * Drop all the mapped document collections in the metadata factory.
353
     */
354
    public function dropCollections()
355
    {
356
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
357
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
358
                continue;
359
            }
360
            $this->dropDocumentCollection($class->name);
361
        }
362
    }
363
364
    /**
365
     * Drop the document collection for a mapped class.
@@ 384-392 (lines=9) @@
381
    /**
382
     * Drop all the mapped document databases in the metadata factory.
383
     */
384
    public function dropDatabases()
385
    {
386
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
387
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
388
                continue;
389
            }
390
            $this->dropDocumentDatabase($class->name);
391
        }
392
    }
393
394
    /**
395
     * Drop the document database for a mapped class.
@@ 412-420 (lines=9) @@
409
    /**
410
     * Create all the mapped document databases in the metadata factory.
411
     */
412
    public function createDatabases()
413
    {
414
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
415
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
416
                continue;
417
            }
418
            $this->createDocumentDatabase($class->name);
419
        }
420
    }
421
422
    /**
423
     * Create the document database for a mapped class.