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

StorageMemcachedModule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
crap 2
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 StorageMemcachedModule extends AbstractModule
14
{
15
    /**
16
     * @var array
17
     */
18
    private $servers;
19
20
    public function __construct($servers, AbstractModule $module = null)
21
    {
22
        $this->servers = \array_map(function ($serverString) {
23
            return \explode(':', $serverString);
24
        }, \explode(',', $servers));
25
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 20 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...
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function configure()
32
    {
33
        $this->bind()->annotatedWith('memcached_servers')->toInstance($this->servers);
34
        $this->bind(CacheProvider::class)->annotatedWith(Storage::class)->toProvider(StorageMemcachedCacheProvider::class);
35
    }
36
}
37