Total Complexity | 6 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class KillCommand extends AbstractCommand |
||
21 | { |
||
22 | |||
23 | /** @var WorkflowInstance $workflowInstance */ |
||
24 | private $workflowInstance; |
||
25 | |||
26 | /** @var TaskInstance $taskInstance */ |
||
27 | private $taskInstance; |
||
28 | |||
29 | /** |
||
30 | * Kills a running task instance |
||
31 | * |
||
32 | * @param WorkflowInstance $workflowInstance The WorkflowInstance |
||
33 | */ |
||
34 | 2 | public function __construct(WorkflowInstance $workflowInstance, TaskInstance $taskInstance) |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * @inheritDoc |
||
42 | */ |
||
43 | 2 | public function getGroup(): string |
|
44 | { |
||
45 | 2 | return 'instance'; |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @inheritDoc |
||
50 | */ |
||
51 | 2 | public function getAction(): string |
|
52 | { |
||
53 | 2 | return 'killtask'; |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * @inheritDoc |
||
58 | */ |
||
59 | 2 | public function getFilters(): array |
|
60 | { |
||
61 | 2 | $pid = $this->taskInstance->getPid(); |
|
62 | 2 | if (empty($pid)) { |
|
63 | 2 | throw new ServerException("Pid Should not be empty"); |
|
64 | } |
||
65 | return [ |
||
66 | 1 | 'id' => $this->workflowInstance->getId(), |
|
67 | 1 | 'pid' => $pid, |
|
68 | ]; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @inheritDoc |
||
73 | */ |
||
74 | 1 | public function getResponseParser() |
|
77 | } |
||
78 | } |
||
79 |