x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.

Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

@@ 486-498 (lines=13) @@
483
    /**
484
     * @return \MongoDB\Database
485
     */
486
    private function createDatabaseObject()
487
    {
488
        $options = [
489
            'readPreference' => $this->readPreference,
490
            'writeConcern' => $this->writeConcern,
491
        ];
492
493
        if ($this->db === null) {
494
            $this->db = $this->connection->getClient()->selectDatabase($this->name, $options);
495
        } else {
496
            $this->db = $this->db->withOptions($options);
497
        }
498
    }
499
500
    private function checkDatabaseName($name)
501
    {

lib/Mongo/MongoCollection.php 1 location

@@ 841-853 (lines=13) @@
838
    /**
839
     * @return \MongoDB\Collection
840
     */
841
    private function createCollectionObject()
842
    {
843
        $options = [
844
            'readPreference' => $this->readPreference,
845
            'writeConcern' => $this->writeConcern,
846
        ];
847
848
        if ($this->collection === null) {
849
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
850
        } else {
851
            $this->collection = $this->collection->withOptions($options);
852
        }
853
    }
854
855
    /**
856
     * Converts legacy write concern options to a WriteConcern object