Completed
Push — spike ( 20d8a1...1c889c )
by Akihito
06:40
created

StorageRedisModule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

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} format
22
     * @param AbstractModule|null $module
23
     */
24
    public function __construct(string $server, AbstractModule $module = null)
25
    {
26
        $this->server = \explode(':', $server);
27
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 24 can also be of type object<Ray\Di\AbstractModule>; however, Ray\Di\AbstractModule::__construct() does only seem to accept null|object<self>, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function configure()
34
    {
35
        $this->bind()->annotatedWith('redis_server')->toInstance($this->server);
36
        $this->bind(CacheProvider::class)->annotatedWith(Storage::class)->toProvider(StorageRedisCacheProvider::class);
37
    }
38
}
39