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

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