RedisConnector   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 11
ccs 0
cts 7
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 7 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/redis-adapter project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Redis\Connector;
10
11
use Daikon\Dbal\Connector\ConnectorInterface;
12
use Daikon\Dbal\Connector\ConnectorTrait;
13
use Redis;
14
15
final class RedisConnector implements ConnectorInterface
16
{
17
    use ConnectorTrait;
18
19
    private function connect(): Redis
20
    {
21
        $redis = new Redis;
22
        $redis->connect($this->settings['host'], $this->settings['port']);
23
        $redis->auth($this->settings['password'] ?? '');
24
        $redis->select((int)($this->settings['database'] ?? 0));
25
        return $redis;
26
    }
27
}
28