Completed
Push — master ( 717b1b...de6dfe )
by Dmitry
06:37
created

Migrate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 17
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 14 3
1
<?php
2
3
namespace Basis\Jobs\Tarantool;
4
5
use Basis\Filesystem;
6
use Tarantool\Mapper\Bootstrap;
7
8
class Migrate
9
{
10
    public function run(Bootstrap $bootstrap, Filesystem $fs)
11
    {
12
        foreach($fs->listFiles('resources/migrations') as $path) {
13
            list($ym, $filename) = explode('/', $path);
14
            $namespace = date_create_from_format('Ym', $ym)->format('FY');
15
            $class = $namespace.'\\'.substr($filename, 0, -4);
16
            if(!class_exists($class, false)) {
17
                include $fs->getPath('resources/migrations/'.$path);
18
            }
19
            $bootstrap->register($class);
20
        }
21
22
        $bootstrap->migrate();
23
    }
24
}