Code Duplication    Length = 13-13 lines in 2 locations

lib/Mongo/MongoDB.php 1 location

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

lib/Mongo/MongoCollection.php 1 location

@@ 905-917 (lines=13) @@
902
    /**
903
     * @return \MongoDB\Collection
904
     */
905
    private function createCollectionObject()
906
    {
907
        $options = [
908
            'readPreference' => $this->readPreference,
909
            'writeConcern' => $this->writeConcern,
910
        ];
911
912
        if ($this->collection === null) {
913
            $this->collection = $this->db->getDb()->selectCollection($this->name, $options);
914
        } else {
915
            $this->collection = $this->collection->withOptions($options);
916
        }
917
    }
918
919
    /**
920
     * Converts legacy write concern options to a WriteConcern object