Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 12 |
| UpdateSubProcess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 12 |
| handle | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 12 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Qmp\Laravel\CommandsLaravel\Middleware\Library\Monitoring; |
| 4 | |
| 5 | use Closure; |
| 6 | use Qmp\Laravel\CommandsLaravel\Middleware\Core\Middleware; |
| 7 | use Qmp\Laravel\CommandsLaravel\Models\CommandMonitoring; |
| 8 | |
| 9 | class UpdateSubProcess extends Middleware |
| 10 | { |
| 11 | /** |
| 12 | * Undocumented function |
| 13 | * |
| 14 | * @param Closure $next |
| 15 | * @return void |
| 16 | */ |
| 17 | protected $parentIdArgument = 'parentId'; |
| 18 | |
| 19 | /** |
| 20 | * Undocumented function |
| 21 | * |
| 22 | * @param Closure $next |
| 23 | * @return mixed |
| 24 | */ |
| 25 | public function handle($IOinterface, $next) |
| 26 | { |
| 27 | $this->setInterface($IOinterface); |
| 28 | |
| 29 | $next = $next($IOinterface); |
| 30 | |
| 31 | CommandMonitoring::where('_id', $this->getParentId()) |
| 32 | ->where('subProcess.id', $this->getId()) |
| 33 | ->update([ |
| 34 | 'subProcess.$.running' => false, |
| 35 | 'subProcess.$.error' => $this->getError(), |
| 36 | 'subProcess.$.pass' => $this->getError() ? false : true, |
| 37 | 'subProcess.$.warning' => $this->getWarning(), |
| 38 | 'subProcess.$.log' => $this->getLog() |
| 39 | ]); |
| 40 | |
| 41 | $this->info("Update subprocess monitoring"); |
| 42 | |
| 43 | return $next; |
| 44 | } |
| 45 | } |