| Conditions | 6 |
| Paths | 24 |
| Total Lines | 31 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function run(Runner $runner, Dispatcher $dispatcher, Service $service, Event $event, Framework $framework, Filesystem $fs) |
||
| 18 | { |
||
| 19 | $service->register(); |
||
| 20 | |||
| 21 | $runner->dispatch('tarantool.migrate'); |
||
| 22 | |||
| 23 | $meta = $runner->dispatch('module.meta'); |
||
| 24 | foreach ($meta['routes'] as $route) { |
||
| 25 | $service->registerRoute($route); |
||
| 26 | } |
||
| 27 | |||
| 28 | foreach ($event->getSubscription() as $event => $listeners) { |
||
|
|
|||
| 29 | $service->subscribe($event); |
||
| 30 | } |
||
| 31 | |||
| 32 | foreach ($framework->listFiles('resources/default') as $file) { |
||
| 33 | if (!$fs->exists($file)) { |
||
| 34 | $source = $framework->getPath("resources/default/$file"); |
||
| 35 | $destination = $fs->getPath($file); |
||
| 36 | file_put_contents($destination, file_get_contents($source)); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | $assets = $runner->dispatch('module.assets'); |
||
| 41 | |||
| 42 | ($service->getName() == 'web' ? $runner : $dispatcher) |
||
| 43 | ->dispatch('asset.register', [ |
||
| 44 | 'service' => $service->getName(), |
||
| 45 | 'hash' => $assets['hash'], |
||
| 46 | ]); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: