CancelCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 1
b 0
f 0
dl 0
loc 48
ccs 10
cts 10
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getAction() 0 3 1
A getFilters() 0 4 1
A __construct() 0 3 1
A getResponseParser() 0 3 1
A getGroup() 0 3 1
1
<?php
2
3
namespace Pheanstalk\Command;
4
5
use Pheanstalk\Parser\RequestOkResponseParser;
6
use Pheanstalk\Structure\WorkflowInstance;
7
8
/**
9
 * The 'Cancel' command.
10
 *
11
 * Cancel a running workflow instance
12
 *
13
 *
14
 * @author  Valentin Corre
15
 * @package Pheanstalk
16
 * @license http://www.opensource.org/licenses/mit-license.php
17
 */
18
class CancelCommand extends AbstractCommand
19
{
20
21
    /** @var WorkflowInstance $workflowInstance */
22
    private $workflowInstance;
23
24
    /**
25
     * Cancel a running workflow instance
26
     *
27
     * @param WorkflowInstance $workflowInstance     The WorkflowInstance
28
     */
29 1
    public function __construct(WorkflowInstance $workflowInstance)
30
    {
31 1
        $this->workflowInstance = $workflowInstance;
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37 1
    public function getGroup(): string
38
    {
39 1
        return 'instance';
40
    }
41
42
    /**
43
     * @inheritDoc
44
     */
45 1
    public function getAction(): string
46
    {
47 1
        return 'cancel';
48
    }
49
50
    /**
51
     * @inheritDoc
52
     */
53 1
    public function getFilters(): array
54
    {
55
        return [
56 1
            'id' => $this->workflowInstance->getId(),
57
        ];
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63 1
    public function getResponseParser()
64
    {
65 1
        return new RequestOkResponseParser();
66
    }
67
}
68