Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

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

lib/Mongo/MongoCollection.php 1 location

@@ 870-882 (lines=13) @@
867
    /**
868
     * @return \MongoDB\Collection
869
     */
870
    private function createCollectionObject()
871
    {
872
        $options = [
873
            'readPreference' => $this->readPreference,
874
            'writeConcern' => $this->writeConcern,
875
        ];
876
877
        if ($this->collection === null) {
878
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
879
        } else {
880
            $this->collection = $this->collection->withOptions($options);
881
        }
882
    }
883
884
    /**
885
     * Converts legacy write concern options to a WriteConcern object