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

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