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