AuraSqlMasterModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
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 37
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A configure() 0 8 1
1
<?php
2
/**
3
 * This file is part of the Ray.AuraSqlModule package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\AuraSqlModule;
8
9
use Aura\Sql\ExtendedPdo;
10
use Aura\Sql\ExtendedPdoInterface;
11
use Ray\Di\AbstractModule;
12
use Ray\Di\Scope;
13
14
class AuraSqlMasterModule extends AbstractModule
15
{
16
    /**
17
     * @var string
18
     */
19
    private $dsn;
20
21
    /**
22
     * @var string
23
     */
24
    private $user;
25
26
    /**
27
     * @var string
28
     */
29
    private $password;
30
31 3
    public function __construct(string $dsn, string $user = '', string $password = '', AbstractModule $module = null)
32
    {
33 3
        $this->dsn = $dsn;
34 3
        $this->user = $user;
35 3
        $this->password = $password;
36 3
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 31 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...
37 3
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 3
    protected function configure()
43
    {
44 3
        $this->bind(ExtendedPdoInterface::class)->toConstructor(ExtendedPdo::class, 'dsn=pdo_dsn,username=pdo_user,password=pdo_pass,options=pdo_option')->in(Scope::SINGLETON);
45 3
        $this->bind()->annotatedWith('pdo_dsn')->toInstance($this->dsn);
46 3
        $this->bind()->annotatedWith('pdo_user')->toInstance($this->user);
47 3
        $this->bind()->annotatedWith('pdo_pass')->toInstance($this->password);
48 3
        $this->bind()->annotatedWith('pdo_option')->toInstance([]);
49 3
    }
50
}
51