@@ -274,8 +274,10 @@ public static function createConnection(string $dsn, array $options = [])
274
274
} elseif (is_a ($ class , \RedisArray::class, true )) {
275
275
foreach ($ hosts as $ i => $ host ) {
276
276
switch ($ host ['scheme ' ]) {
277
- case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ]; break ;
278
- case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ]; break ;
277
+ case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ];
278
+ break ;
279
+ case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ];
280
+ break ;
279
281
default : $ hosts [$ i ] = $ host ['path ' ];
280
282
}
281
283
}
@@ -295,8 +297,10 @@ public static function createConnection(string $dsn, array $options = [])
295
297
$ initializer = static function () use ($ class , $ params , $ dsn , $ hosts ) {
296
298
foreach ($ hosts as $ i => $ host ) {
297
299
switch ($ host ['scheme ' ]) {
298
- case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ]; break ;
299
- case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ]; break ;
300
+ case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ];
301
+ break ;
302
+ case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ];
303
+ break ;
300
304
default : $ hosts [$ i ] = $ host ['path ' ];
301
305
}
302
306
}
@@ -311,9 +315,12 @@ public static function createConnection(string $dsn, array $options = [])
311
315
$ redis ->setOption (\Redis::OPT_TCP_KEEPALIVE , $ params ['tcp_keepalive ' ]);
312
316
}
313
317
switch ($ params ['failover ' ]) {
314
- case 'error ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_ERROR ); break ;
315
- case 'distribute ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE ); break ;
316
- case 'slaves ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES ); break ;
318
+ case 'error ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_ERROR );
319
+ break ;
320
+ case 'distribute ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE );
321
+ break ;
322
+ case 'slaves ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES );
323
+ break ;
317
324
}
318
325
319
326
return $ redis ;
0 commit comments