MigrationsBootstrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBindings() 0 4 1
A registerBindings() 0 11 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Files\Bootstrappers\Database;
6
7
use AbterPhp\Admin\Bootstrappers\Filesystem\FileFinderBootstrapper;
8
use AbterPhp\Files\Databases\Migrations\Init;
9
use AbterPhp\Framework\Filesystem\IFileFinder; // @phan-suppress-current-line PhanUnreferencedUseNormal
10
use Opulence\Databases\IConnection; // @phan-suppress-current-line PhanUnreferencedUseNormal
11
use Opulence\Ioc\Bootstrappers\Bootstrapper;
12
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
13
use Opulence\Ioc\IContainer;
14
15
class MigrationsBootstrapper extends Bootstrapper implements ILazyBootstrapper
16
{
17
    /**
18
     * @return array
19
     */
20
    public function getBindings(): array
21
    {
22
        return [
23
            Init::class,
24
        ];
25
    }
26
27
    /**
28
     * @param IContainer $container
29
     *
30
     * @throws \Opulence\Ioc\IocException
31
     */
32
    public function registerBindings(IContainer $container)
33
    {
34
        /** @var IConnection $connection */
35
        $connection = $container->resolve(IConnection::class);
36
37
        /** @var IFileFinder $fileFinder */
38
        $fileFinder = $container->resolve(FileFinderBootstrapper::MIGRATION_FILE_FINDER);
39
40
        $migration = new Init($connection, $fileFinder);
41
42
        $container->bindInstance(Init::class, $migration);
43
    }
44
}
45