Completed
Push — master ( 126914...10d409 )
by
unknown
02:45
created

MigrateAllCommand::getConfigurations()   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 0
1
<?php
2
/**
3
 * Reddogs (https://github.com/reddogs-at)
4
 *
5
 * @see https://github.com/reddogs-at/reddogs-doctrine-migrations for the canonical source repository
6
 * @license https://github.com/reddogs-at/reddogs-doctrine-migrations/blob/master/LICENSE MIT License
7
 */
8
namespace Reddogs\Doctrine\Migrations;
9
10
use Zend\Console\Adapter\AdapterInterface;
11
use ZF\Console\Route;
12
13
class MigrateAllCommand
14
{
15
16
    /**
17
     * Configurations
18
     * 
19
     * @var array
20
     */
21
    private $configurations;
22
23
    /**
24
     * Migrations
25
     * 
26
     * @var array
27
     */
28
    private $migrations;
29
30
    /**
31
     * Constructor
32
     * 
33
     * @param array $configurations
34
     * @param array $migrations 
35
     */
36
     public function __construct(array $configurations, array $migrations)
37
     {
38
         $this->configurations = $configurations;
39
         $this->migrations = $migrations;
40
     }
41
42
     /**
43
      * Get configurations
44
      *
45
      * return array
46
      */
47
     public function getConfigurations()
48
     {
49
         return $this->configurations;
50
     }
51
52
     /**
53
      * Get migrations
54
      * 
55
      * @return array
56
      */
57
     public function getMigrations()
58
     {
59
         return $this->migrations;
60
     }
61
62
    /**
63
     * Invoke 
64
     *
65
     * @param Route $route
66
     * @param AdapterInterface $console
67
     */
68
    public function __invoke(Route $route, AdapterInterface $console)
69
    {
70
        $migrations = $this->getMigrations();
71
        foreach($this->getConfigurations() as $key => $configuration) {
72
            $configuration->createMigrationTable();
73
            $migrations[$key]->migrate();
74
        }
75
    }
76
}