Skip to content

Commit b574d5d

Browse files
committed
refactor: use class constant for magic number
1 parent 1749d9b commit b574d5d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

system/Session/Handlers/RedisHandler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
*/
2323
class RedisHandler extends BaseHandler
2424
{
25+
/**
26+
* @var int
27+
*/
28+
private const REDIS_DEFAULT_PORT = 6379;
29+
2530
/**
2631
* phpRedis instance
2732
*
@@ -77,7 +82,7 @@ public function __construct(AppConfig $config, string $ipAddress)
7782

7883
$this->savePath = [
7984
'host' => $matches[1],
80-
'port' => empty($matches[2]) ? 6379 : $matches[2],
85+
'port' => empty($matches[2]) ? self::REDIS_DEFAULT_PORT : $matches[2],
8186
'password' => preg_match('#auth=([^\s&]+)#', $matches[3], $match) ? $match[1] : null,
8287
'database' => preg_match('#database=(\d+)#', $matches[3], $match) ? (int) $match[1] : 0,
8388
'timeout' => preg_match('#timeout=(\d+\.\d+)#', $matches[3], $match) ? (float) $match[1] : 0,

0 commit comments

Comments
 (0)