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

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