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

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