Completed
Push — master ( af31d4...ec158a )
by Timo
10s
created

RedisDriver::_setContainer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
crap 2
1
<?php
2
3
namespace hamburgscleanest\GuzzleAdvancedThrottle\Cache\Drivers;
4
5
use hamburgscleanest\GuzzleAdvancedThrottle\Exceptions\RedisDatabaseNotSetException;
6
use Illuminate\Redis\RedisManager;
7
8
/**
9
 * Class RedisDriver
10
 * @package hamburgscleanest\GuzzleAdvancedThrottle\Cache\Drivers
11
 */
12
class RedisDriver extends LaravelDriver
13
{
14
15
    /**
16
     * @throws \hamburgscleanest\GuzzleAdvancedThrottle\Exceptions\RedisDatabaseNotSetException
17
     */
18 3
    protected function _setContainer() : void
19
    {
20 3
        if (!isset($this->_options['database']))
21
        {
22 1
            throw new RedisDatabaseNotSetException();
23
        }
24
25 2
        $this->_container['redis'] = new RedisManager('predis', $this->_options['database']);
26
    }
27
}