Passed
Push — master ( 3d85c1...365911 )
by Peter
02:26
created

MigrationsBootstrapper::getMigrationPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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