| Conditions | 6 |
| Paths | 12 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 6.0073 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 2 | public function run(Mapper $mapper, Bootstrap $bootstrap, Filesystem $fs, Application $app) |
|
| 15 | { |
||
| 16 | 2 | $mapper->getPlugin(Annotation::class)->migrate(); |
|
| 17 | |||
| 18 | 2 | $migrations = []; |
|
| 19 | 2 | foreach ($fs->listClasses('Migration') as $class) { |
|
| 20 | 1 | $reflection = new ReflectionClass($class); |
|
| 21 | 1 | $created_at = $reflection->getDefaultProperties()['created_at']; |
|
| 22 | 1 | if (!array_key_exists($created_at, $migrations)) { |
|
| 23 | 1 | $migrations[$created_at] = []; |
|
| 24 | } |
||
| 25 | 1 | $migrations[$created_at][] = $class; |
|
| 26 | } |
||
| 27 | 2 | ksort($migrations); |
|
| 28 | |||
| 29 | 2 | foreach ($migrations as $collection) { |
|
| 30 | 1 | foreach ($collection as $class) { |
|
| 31 | 1 | if (method_exists($class, '__construct')) { |
|
| 32 | $class = $app->get($class); |
||
| 33 | } |
||
| 34 | 1 | $bootstrap->register($class); |
|
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | 2 | $bootstrap->migrate(); |
|
| 39 | 2 | } |
|
| 40 | } |
||
| 41 |