Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

@@ 500-512 (lines=13) @@
497
    /**
498
     * @return \MongoDB\Database
499
     */
500
    private function createDatabaseObject()
501
    {
502
        $options = [
503
            'readPreference' => $this->readPreference,
504
            'writeConcern' => $this->writeConcern,
505
        ];
506
507
        if ($this->db === null) {
508
            $this->db = $this->connection->getClient()->selectDatabase($this->name, $options);
509
        } else {
510
            $this->db = $this->db->withOptions($options);
511
        }
512
    }
513
514
    private function checkDatabaseName($name)
515
    {

lib/Mongo/MongoCollection.php 1 location

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