| Conditions | 5 |
| Paths | 12 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function run(Runner $runner, Service $service, Event $event) |
||
| 17 | { |
||
| 18 | $runner->dispatch('tarantool.migrate'); |
||
| 19 | |||
| 20 | $meta = $runner->dispatch('module.meta'); |
||
| 21 | foreach ($meta['jobs'] as $job) { |
||
| 22 | $class = new ReflectionClass($runner->getJobClass($job)); |
||
| 23 | $params = []; |
||
| 24 | foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { |
||
| 25 | $params[] = $property->getName(); |
||
| 26 | } |
||
| 27 | $service->registerJob($job, $params); |
||
| 28 | } |
||
| 29 | |||
| 30 | foreach ($meta['routes'] as $route) { |
||
| 31 | $service->registerRoute($route); |
||
| 32 | } |
||
| 33 | |||
| 34 | foreach ($event->getSubscription() as $event => $listeners) { |
||
|
|
|||
| 35 | $service->subscribe($event); |
||
| 36 | } |
||
| 37 | |||
| 38 | $assets = $runner->dispatch('module.assets'); |
||
| 39 | $service->updateAssetsVersion($assets['hash']); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: