Completed
Push — master ( 346e09...46a5ae )
by Dmitry
06:10
created

Bootstrap::store()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 17
ccs 0
cts 15
cp 0
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 11
nc 4
nop 3
crap 12
1
<?php
2
3
namespace Basis\Jobs\Module;
4
5
use Basis\Filesystem;
6
use Basis\Etcd;
7
use Basis\Runner;
8
use Exception;
9
use ReflectionClass;
10
use ReflectionProperty;
11
12
class Bootstrap
13
{
14
    public function run(Runner $runner, Etcd $etcd, Filesystem $fs)
15
    {
16
        $runner->dispatch('tarantool.migrate');
17
18
        $etcd->registerService();
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
            $etcd->registerJob($job, $params);
28
        }
29
30 View Code Duplication
        foreach($fs->listClasses('Listeners') as $class) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
            $event = str_replace('\\', '.', substr(strtolower($class), 10));
32
            $etcd->subscribe($event);
33
        }
34
    }
35
}
36