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