File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -111,20 +111,20 @@ protected function getDsn(array $config)
111
111
// Treat host option as array of hosts
112
112
$ hosts = is_array ($ config ['host ' ]) ? $ config ['host ' ] : array ($ config ['host ' ]);
113
113
114
- foreach ( $ hosts as & $ host )
114
+ if ( isset ( $ config [ ' username ' ]) and isset ( $ config [ ' password ' ]) )
115
115
{
116
- if (isset ($ config ['username ' ]) and isset ($ config ['password ' ]))
117
- {
118
- $ host = "{$ username }: {$ password }@ {$ host }" ;
119
- }
116
+ $ credentials = "{$ username }: {$ password }@ " ;
117
+ }
120
118
119
+ foreach ($ hosts as &$ host )
120
+ {
121
121
if (isset ($ config ['port ' ]))
122
122
{
123
123
$ host = "{$ host }: {$ port }" ;
124
124
}
125
125
}
126
126
127
- return "mongodb:// " . implode (', ' , $ hosts ) . "/ {$ database }" ;
127
+ echo "mongodb:// " . $ credentials . implode (', ' , $ hosts ) . "/ {$ database }" ;
128
128
}
129
129
130
130
/**
You can’t perform that action at this time.
0 commit comments