Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

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

lib/Mongo/MongoCollection.php 1 location

@@ 842-854 (lines=13) @@
839
    /**
840
     * @return \MongoDB\Collection
841
     */
842
    private function createCollectionObject()
843
    {
844
        $options = [
845
            'readPreference' => $this->readPreference,
846
            'writeConcern' => $this->writeConcern,
847
        ];
848
849
        if ($this->collection === null) {
850
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
851
        } else {
852
            $this->collection = $this->collection->withOptions($options);
853
        }
854
    }
855
856
    /**
857
     * Converts legacy write concern options to a WriteConcern object