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