AuraSqlBaseModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A configure() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\AuraSqlModule;
6
7
use Override;
8
use Ray\AuraSqlModule\Pagerfanta\AuraSqlPagerModule;
9
use Ray\Di\AbstractModule;
10
11
use function preg_match;
12
13
final class AuraSqlBaseModule extends AbstractModule
14
{
15
    public function __construct(private readonly string $dsn, ?AbstractModule $module = null)
16
    {
17
        parent::__construct($module);
18
    }
19
20
    /**
21
     * {@inheritDoc}
22
     */
23
    #[Override]
24
    protected function configure(): void
25
    {
26
        // @Transactional
27
        $this->install(new TransactionalModule());
28
        $this->install(new AuraSqlPagerModule());
29
        preg_match(AuraSqlModule::PARSE_PDO_DSN_REGEX, $this->dsn, $parts);
30
        $dbType = $parts[1] ?? '';
31
        $this->install(new AuraSqlQueryModule($dbType));
32
    }
33
}
34