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