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.
@@ 382-390 (lines=9) @@
379
    /**
380
     * Drop all the mapped document databases in the metadata factory.
381
     */
382
    public function dropDatabases()
383
    {
384
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
385
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
386
                continue;
387
            }
388
            $this->dropDocumentDatabase($class->name);
389
        }
390
    }
391
392
    /**
393
     * Drop the document database for a mapped class.
@@ 410-418 (lines=9) @@
407
    /**
408
     * Create all the mapped document databases in the metadata factory.
409
     */
410
    public function createDatabases()
411
    {
412
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
413
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
414
                continue;
415
            }
416
            $this->createDocumentDatabase($class->name);
417
        }
418
    }
419
420
    /**
421
     * Create the document database for a mapped class.