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