MigrationsBootstrapper::registerBindings()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 11
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Bootstrappers\Database;
6
7
use AbterPhp\Admin\Bootstrappers\Filesystem\FileFinderBootstrapper;
8
use AbterPhp\Admin\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
use Opulence\Ioc\IocException;
15
16
class MigrationsBootstrapper extends Bootstrapper implements ILazyBootstrapper
17
{
18
    /**
19
     * @return string[]
20
     */
21
    public function getBindings(): array
22
    {
23
        return [
24
            Init::class,
25
        ];
26
    }
27
28
    /**
29
     * @param IContainer $container
30
     *
31
     * @throws IocException
32
     */
33
    public function registerBindings(IContainer $container)
34
    {
35
        /** @var IConnection $connection */
36
        $connection = $container->resolve(IConnection::class);
37
38
        /** @var IFileFinder $fileFinder */
39
        $fileFinder = $container->resolve(FileFinderBootstrapper::MIGRATION_FILE_FINDER);
40
41
        $migration = new Init($connection, $fileFinder);
42
43
        $container->bindInstance(Init::class, $migration);
44
    }
45
}
46