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

@@ 858-870 (lines=13) @@
855
    /**
856
     * @return \MongoDB\Collection
857
     */
858
    private function createCollectionObject()
859
    {
860
        $options = [
861
            'readPreference' => $this->readPreference,
862
            'writeConcern' => $this->writeConcern,
863
        ];
864
865
        if ($this->collection === null) {
866
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
867
        } else {
868
            $this->collection = $this->collection->withOptions($options);
869
        }
870
    }
871
872
    /**
873
     * Converts legacy write concern options to a WriteConcern object