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