Passed
Push — master ( 27b181...baff18 )
by Aleksei
26:54 queued 24:15
created

MigratorFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 15
ccs 10
cts 10
cp 1
rs 10
c 2
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Factory;
6
7
use Cycle\Database\DatabaseManager;
8
use Cycle\Migrations\Config\MigrationConfig;
9
use Cycle\Migrations\FileRepository;
10
use Cycle\Migrations\Migrator;
11
use Psr\Container\ContainerInterface;
12
use Spiral\Core\FactoryInterface;
13
14
final class MigratorFactory
15
{
16 1
    public function __invoke(ContainerInterface $container): Migrator
17
    {
18 1
        $migConf = $container->get(MigrationConfig::class);
19 1
        $dbal = $container->get(DatabaseManager::class);
20
21 1
        $migrator = new Migrator(
22 1
            $migConf,
23 1
            $dbal,
24 1
            new FileRepository($migConf, $container->get(FactoryInterface::class))
25 1
        );
26
        // Init migration table
27 1
        $migrator->configure();
28 1
        return $migrator;
29
    }
30
}
31