Completed
Push — cache ( ce1318 )
by Akihito
11s
created

StorageRedisModule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 26
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 5 1
1
<?php
2
/**
3
 * This file is part of the BEAR.QueryRepository package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\QueryRepository;
8
9
use BEAR\RepositoryModule\Annotation\Storage;
10
use Doctrine\Common\Cache\CacheProvider;
11
use Ray\Di\AbstractModule;
12
13
class StorageRedisModule extends AbstractModule
14
{
15
    /**
16
     * @var array
17
     */
18
    private $server;
19
20
    /**
21
     * @param string              $server {host}:{port}
22
     * @param AbstractModule|null $module
23
     */
24 1
    public function __construct($server, AbstractModule $module = null)
25
    {
26 1
        $this->server = explode(':', $server);
27 1
        parent::__construct($module);
28 1
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 1
    protected function configure()
34
    {
35 1
        $this->bind()->annotatedWith('redis_server')->toInstance($this->server);
36 1
        $this->bind(CacheProvider::class)->annotatedWith(Storage::class)->toProvider(StorageRedisCacheProvider::class);
37 1
    }
38
}
39