Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

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

lib/Mongo/MongoCollection.php 1 location

@@ 676-688 (lines=13) @@
673
    /**
674
     * @return \MongoDB\Collection
675
     */
676
    private function createCollectionObject()
677
    {
678
        $options = [
679
            'readPreference' => $this->readPreference,
680
            'writeConcern' => $this->writeConcern,
681
        ];
682
683
        if ($this->collection === null) {
684
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
685
        } else {
686
            $this->collection = $this->collection->withOptions($options);
687
        }
688
    }
689
}
690
691