Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

@@ 465-477 (lines=13) @@
462
    /**
463
     * @return \MongoDB\Database
464
     */
465
    private function createDatabaseObject()
466
    {
467
        $options = [
468
            'readPreference' => $this->readPreference,
469
            'writeConcern' => $this->writeConcern,
470
        ];
471
472
        if ($this->db === null) {
473
            $this->db = $this->connection->getClient()->selectDatabase($this->name, $options);
474
        } else {
475
            $this->db = $this->db->withOptions($options);
476
        }
477
    }
478
}
479

lib/Mongo/MongoCollection.php 1 location

@@ 702-714 (lines=13) @@
699
    /**
700
     * @return \MongoDB\Collection
701
     */
702
    private function createCollectionObject()
703
    {
704
        $options = [
705
            'readPreference' => $this->readPreference,
706
            'writeConcern' => $this->writeConcern,
707
        ];
708
709
        if ($this->collection === null) {
710
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
711
        } else {
712
            $this->collection = $this->collection->withOptions($options);
713
        }
714
    }
715
716
    /**
717
     * Converts legacy write concern options to a WriteConcern object