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