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

@@ 828-840 (lines=13) @@
825
    /**
826
     * @return \MongoDB\Collection
827
     */
828
    private function createCollectionObject()
829
    {
830
        $options = [
831
            'readPreference' => $this->readPreference,
832
            'writeConcern' => $this->writeConcern,
833
        ];
834
835
        if ($this->collection === null) {
836
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
837
        } else {
838
            $this->collection = $this->collection->withOptions($options);
839
        }
840
    }
841
842
    /**
843
     * Converts legacy write concern options to a WriteConcern object