Passed
Push — master ( 5a87d9...5af04f )
by Mihail
03:04
created

PredisConfiguration   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getConnectionParams() 0 6 1
A getOptions() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Koded package.
5
 *
6
 * (c) Mihail Binev <[email protected]>
7
 *
8
 * Please view the LICENSE distributed with this source code
9
 * for the full copyright and license information.
10
 *
11
 */
12
13
namespace Koded\Caching\Configuration;
14
15
use Koded\Stdlib\Immutable;
16
use Koded\Stdlib\Interfaces\{Configuration, Serializer};
17
18
final class PredisConfiguration extends Immutable implements Configuration
19
{
20
21 387
    public function __construct(array $values)
22
    {
23
        $values += [
24 387
            'serializer' => Serializer::PHP,
25
            'binary' => Serializer::PHP,
26
        ];
27
28 387
        parent::__construct($values);
29 387
    }
30
31 387
    public function getConnectionParams(): array
32
    {
33
        return [
34 387
            'scheme' => $this->get('scheme', 'tcp'),
35 387
            'host' => $this->get('host', '127.0.0.1'),
36 387
            'port' => $this->get('port', 6379)
37
        ];
38
    }
39
40 387
    public function getOptions(): ?array
41
    {
42 387
        return $this->get('options');
43
    }
44
}
45