Conditions | 8 |
Paths | 28 |
Total Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 8 |
Changes | 0 |
1 | <?php |
||
16 | 4 | public function run(Filesystem $fs) |
|
17 | { |
||
18 | 4 | $result = []; |
|
19 | 4 | $cache = $fs->getPath('.cache'); |
|
20 | 4 | if (is_dir($cache)) { |
|
21 | 4 | foreach ($fs->listFiles('.cache') as $file) { |
|
22 | 4 | unlink($fs->getPath('.cache/'.$file)); |
|
23 | } |
||
24 | } |
||
25 | |||
26 | 4 | $procedures = $fs->listClasses('Procedure'); |
|
27 | 4 | if (count($procedures)) { |
|
28 | 4 | foreach ($procedures as $procedure) { |
|
29 | 4 | $this->get(Mapper::class)->getPlugin(Procedure::class)->register($procedure); |
|
30 | } |
||
31 | } |
||
32 | |||
33 | 4 | foreach ($this->jobs as $job) { |
|
34 | try { |
||
35 | 4 | $result[$job] = $this->dispatch($job); |
|
36 | 3 | } catch (Exception $e) { |
|
37 | 3 | $result[$job] = $e->getMessage(); |
|
38 | } |
||
39 | } |
||
40 | |||
41 | 4 | if ($this->app->has(Mapper::class)) { |
|
42 | 4 | $this->get(Mapper::class)->getPlugin(Procedure::class) |
|
43 | 4 | ->register(Select::class); |
|
44 | } |
||
45 | |||
46 | 4 | return $result; |
|
47 | } |
||
48 | } |
||
49 |