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

Bootstrap::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
}