Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

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

lib/Mongo/MongoCollection.php 1 location

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