AuraSqlQueryModule::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
rs 10
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