Passed
Pull Request — master (#26)
by Valentin
05:17
created

CancelCommand::parseResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 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