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

Bootstrap   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A register() 0 4 1
A migrate() 0 9 3
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
}