Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

@@ 505-517 (lines=13) @@
502
    /**
503
     * @return \MongoDB\Database
504
     */
505
    private function createDatabaseObject()
506
    {
507
        $options = [
508
            'readPreference' => $this->readPreference,
509
            'writeConcern' => $this->writeConcern,
510
        ];
511
512
        if ($this->db === null) {
513
            $this->db = $this->connection->getClient()->selectDatabase($this->name, $options);
514
        } else {
515
            $this->db = $this->db->withOptions($options);
516
        }
517
    }
518
519
    private function checkDatabaseName($name)
520
    {

lib/Mongo/MongoCollection.php 1 location

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