Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 36-44 (lines=9) @@
33
     *
34
     * @param int $timeout Timeout (ms) for acknowledged index creation
35
     */
36
    public function ensureIndexes($timeout = null)
37
    {
38
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
39
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
40
                continue;
41
            }
42
43
            $this->ensureDocumentIndexes($class->name, $timeout);
44
        }
45
    }
46
47
    /**
@@ 55-63 (lines=9) @@
52
     *
53
     * @param int $timeout Timeout (ms) for acknowledged index creation
54
     */
55
    public function updateIndexes($timeout = null)
56
    {
57
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
58
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
59
                continue;
60
            }
61
62
            $this->updateDocumentIndexes($class->name, $timeout);
63
        }
64
    }
65
66
    /**
@@ 263-271 (lines=9) @@
260
     * Delete indexes for all documents that can be loaded with the
261
     * metadata factory.
262
     */
263
    public function deleteIndexes()
264
    {
265
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
266
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
267
                continue;
268
            }
269
270
            $this->deleteDocumentIndexes($class->name);
271
        }
272
    }
273
274
    /**
@@ 293-301 (lines=9) @@
290
    /**
291
     * Create all the mapped document collections in the metadata factory.
292
     */
293
    public function createCollections()
294
    {
295
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
296
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
297
                continue;
298
            }
299
            $this->createDocumentCollection($class->name);
300
        }
301
    }
302
303
    /**
304
     * Create the document collection for a mapped class.
@@ 337-345 (lines=9) @@
334
    /**
335
     * Drop all the mapped document collections in the metadata factory.
336
     */
337
    public function dropCollections()
338
    {
339
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
340
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
341
                continue;
342
            }
343
344
            $this->dropDocumentCollection($class->name);
345
        }
346
    }
347
348
    /**
@@ 373-381 (lines=9) @@
370
    /**
371
     * Drop all the mapped document databases in the metadata factory.
372
     */
373
    public function dropDatabases()
374
    {
375
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
376
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
377
                continue;
378
            }
379
380
            $this->dropDocumentDatabase($class->name);
381
        }
382
    }
383
384
    /**