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