Code Duplication    Length = 9-9 lines in 6 locations

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

@@ 251-259 (lines=9) @@
248
     * Delete indexes for all documents that can be loaded with the
249
     * metadata factory.
250
     */
251
    public function deleteIndexes()
252
    {
253
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
254
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
255
                continue;
256
            }
257
            $this->deleteDocumentIndexes($class->name);
258
        }
259
    }
260
261
    /**
262
     * Delete the given document's indexes.
@@ 279-287 (lines=9) @@
276
    /**
277
     * Create all the mapped document collections in the metadata factory.
278
     */
279
    public function createCollections()
280
    {
281
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
282
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
283
                continue;
284
            }
285
            $this->createDocumentCollection($class->name);
286
        }
287
    }
288
289
    /**
290
     * Create the document collection for a mapped class.
@@ 316-324 (lines=9) @@
313
    /**
314
     * Drop all the mapped document collections in the metadata factory.
315
     */
316
    public function dropCollections()
317
    {
318
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
319
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
320
                continue;
321
            }
322
            $this->dropDocumentCollection($class->name);
323
        }
324
    }
325
326
    /**
327
     * Drop the document collection for a mapped class.
@@ 344-352 (lines=9) @@
341
    /**
342
     * Drop all the mapped document databases in the metadata factory.
343
     */
344
    public function dropDatabases()
345
    {
346
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
347
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
348
                continue;
349
            }
350
            $this->dropDocumentDatabase($class->name);
351
        }
352
    }
353
354
    /**
355
     * Drop the document database for a mapped class.
@@ 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
            $this->updateDocumentIndexes($class->name, $timeout);
62
        }
63
    }
64
65
    /**
66
     * Ensure indexes exist for the mapped document class.
@@ 37-45 (lines=9) @@
34
     *
35
     * @param int $timeout Timeout (ms) for acknowledged index creation
36
     */
37
    public function ensureIndexes($timeout = null)
38
    {
39
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
40
            if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
41
                continue;
42
            }
43
            $this->ensureDocumentIndexes($class->name, $timeout);
44
        }
45
    }
46
47
    /**
48
     * Ensure indexes exist for all mapped document classes.