Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

@@ 516-528 (lines=13) @@
513
    /**
514
     * @return \MongoDB\Database
515
     */
516
    private function createDatabaseObject()
517
    {
518
        $options = [
519
            'readPreference' => $this->readPreference,
520
            'writeConcern' => $this->writeConcern,
521
        ];
522
523
        if ($this->db === null) {
524
            $this->db = $this->connection->getClient()->selectDatabase($this->name, $options);
525
        } else {
526
            $this->db = $this->db->withOptions($options);
527
        }
528
    }
529
530
    private function checkDatabaseName($name)
531
    {

lib/Mongo/MongoCollection.php 1 location

@@ 985-997 (lines=13) @@
982
    /**
983
     * @return \MongoDB\Collection
984
     */
985
    private function createCollectionObject()
986
    {
987
        $options = [
988
            'readPreference' => $this->readPreference,
989
            'writeConcern' => $this->writeConcern,
990
        ];
991
992
        if ($this->collection === null) {
993
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
994
        } else {
995
            $this->collection = $this->collection->withOptions($options);
996
        }
997
    }
998
999
    /**
1000
     * Converts legacy write concern options to a WriteConcern object