Completed
Push — master ( 417e7e...8f7e9a )
by Dmitry
02:15
created

Bootstrap::migrate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 0
1
<?php
2
3
namespace Tarantool\Mapper;
4
5
class Bootstrap
6
{
7
    private $mapper;
8
    private $migrations = [];
9
10
    public function __construct(Mapper $mapper)
11
    {
12
        $this->mapper = $mapper;
13
    }
14
15
    public function register($instance)
16
    {
17
        $this->migrations[] = $instance;
18
    }
19
20
    public function migrate()
21
    {
22
        foreach($this->migrations as $migration) {
23
            if(!is_object($migration)) {
24
                $migration = new $migration;
25
            }
26
            $migration->migrate($this->mapper);
27
        }
28
    }
29
}