AuraSqlQueryModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 9
c 1
b 0
f 1
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\AuraSqlModule;
6
7
use Aura\SqlQuery\Common\DeleteInterface;
8
use Aura\SqlQuery\Common\InsertInterface;
9
use Aura\SqlQuery\Common\SelectInterface;
10
use Aura\SqlQuery\Common\UpdateInterface;
11
use Ray\AuraSqlModule\Annotation\AuraSqlQueryConfig;
12
use Ray\Di\AbstractModule;
13
14
class AuraSqlQueryModule extends AbstractModule
15
{
16
    private string $db;
17
18
    public function __construct(string $db, ?AbstractModule $module = null)
19
    {
20
        $this->db = $db;
21
        parent::__construct($module);
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function configure(): void
28
    {
29
        $this->bind()->annotatedWith(AuraSqlQueryConfig::class)->toInstance($this->db);
30
        $this->bind(SelectInterface::class)->toProvider(AuraSqlQuerySelectProvider::class);
31
        $this->bind(InsertInterface::class)->toProvider(AuraSqlQueryInsertProvider::class);
32
        $this->bind(UpdateInterface::class)->toProvider(AuraSqlQueryUpdateProvider::class);
33
        $this->bind(DeleteInterface::class)->toProvider(AuraSqlQueryDeleteProvider::class);
34
    }
35
}
36