Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

@@ 514-526 (lines=13) @@
511
    /**
512
     * @return \MongoDB\Database
513
     */
514
    private function createDatabaseObject()
515
    {
516
        $options = [
517
            'readPreference' => $this->readPreference,
518
            'writeConcern' => $this->writeConcern,
519
        ];
520
521
        if ($this->db === null) {
522
            $this->db = $this->connection->getClient()->selectDatabase($this->name, $options);
523
        } else {
524
            $this->db = $this->db->withOptions($options);
525
        }
526
    }
527
528
    private function checkDatabaseName($name)
529
    {

lib/Mongo/MongoCollection.php 1 location

@@ 935-947 (lines=13) @@
932
    /**
933
     * @return \MongoDB\Collection
934
     */
935
    private function createCollectionObject()
936
    {
937
        $options = [
938
            'readPreference' => $this->readPreference,
939
            'writeConcern' => $this->writeConcern,
940
        ];
941
942
        if ($this->collection === null) {
943
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
944
        } else {
945
            $this->collection = $this->collection->withOptions($options);
946
        }
947
    }
948
949
    /**
950
     * Converts legacy write concern options to a WriteConcern object