AuraSqlQueryModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A __construct() 0 5 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
22
        parent::__construct($module);
23
    }
24
25
    /**
26
     * {@inheritDoc}
27
     */
28
    protected function configure(): void
29
    {
30
        $this->bind()->annotatedWith(AuraSqlQueryConfig::class)->toInstance($this->db);
31
        $this->bind(SelectInterface::class)->toProvider(AuraSqlQuerySelectProvider::class);
32
        $this->bind(InsertInterface::class)->toProvider(AuraSqlQueryInsertProvider::class);
33
        $this->bind(UpdateInterface::class)->toProvider(AuraSqlQueryUpdateProvider::class);
34
        $this->bind(DeleteInterface::class)->toProvider(AuraSqlQueryDeleteProvider::class);
35
    }
36
}
37