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

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