Code Duplication    Length = 8-8 lines in 4 locations

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

@@ 297-304 (lines=8) @@
294
     * @param string $documentName
295
     * @throws \InvalidArgumentException
296
     */
297
    public function deleteDocumentIndexes($documentName)
298
    {
299
        $class = $this->dm->getClassMetadata($documentName);
300
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
301
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes, embedded documents or query result documents.');
302
        }
303
        $this->dm->getDocumentCollection($documentName)->deleteIndexes();
304
    }
305
306
    /**
307
     * Create all the mapped document collections in the metadata factory.
@@ 367-374 (lines=8) @@
364
     * @param string $documentName
365
     * @throws \InvalidArgumentException
366
     */
367
    public function dropDocumentCollection($documentName)
368
    {
369
        $class = $this->dm->getClassMetadata($documentName);
370
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
371
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes, embedded documents or query result documents.');
372
        }
373
        $this->dm->getDocumentCollection($documentName)->drop();
374
    }
375
376
    /**
377
     * Drop all the mapped document databases in the metadata factory.
@@ 395-402 (lines=8) @@
392
     * @param string $documentName
393
     * @throws \InvalidArgumentException
394
     */
395
    public function dropDocumentDatabase($documentName)
396
    {
397
        $class = $this->dm->getClassMetadata($documentName);
398
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
399
            throw new \InvalidArgumentException('Cannot drop document database for mapped super classes, embedded documents or query result documents.');
400
        }
401
        $this->dm->getDocumentDatabase($documentName)->drop();
402
    }
403
404
    /**
405
     * Create all the mapped document databases in the metadata factory.
@@ 427-434 (lines=8) @@
424
     *
425
     * @deprecated A database is created automatically by MongoDB (>= 3.0). Deprecated since ODM 1.2, to be removed in ODM 2.0.
426
     */
427
    public function createDocumentDatabase($documentName)
428
    {
429
        $class = $this->dm->getClassMetadata($documentName);
430
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
431
            throw new \InvalidArgumentException('Cannot create databases for mapped super classes, embedded documents or query result documents.');
432
        }
433
434
        $this->dm->getDocumentDatabase($documentName)->execute('function() { return true; }');
435
    }
436
437
    /**