Completed
Branch master (450f26)
by Valentin
01:46
created

DeleteTubeCommand::getAction()   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 0
crap 1
1
<?php
2
3
namespace Pheanstalk\Command;
4
5
use Pheanstalk\Structure\Tube;
6
use Pheanstalk\Structure\Workflow;
7
8
/**
9
 * The 'deleteTube' command.
10
 *
11
 * Permanently deletes a tube.
12
 *
13
 * @author  Paul Annesley
14
 * @package Pheanstalk
15
 * @license http://www.opensource.org/licenses/mit-license.php
16
 */
17
class DeleteTubeCommand extends AbstractCommand implements \Pheanstalk\ResponseParser
18
{
19
    /** @var Tube $tube */
20
    private $tube;
21
22
    /**
23
     * @param Tube $tube
24
     */
25 1
    public function __construct(Tube $tube)
26
    {
27 1
        $this->tube = $tube;
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33 1
    public function getGroup(): string
34
    {
35 1
        return 'queue';
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41 1
    public function getAction(): string
42
    {
43 1
        return 'delete';
44
    }
45
46
    /**
47
     * @inheritDoc
48
     */
49 1
    public function getFilters(): array
50
    {
51
        return [
52 1
            'id' => $this->tube->getId()
53
        ];
54
    }
55
56
    /**
57
     * @inheritDoc
58
     */
59 1
    public function getResponseParser()
60
    {
61 1
        return $this;
62
    }
63
64
    /**
65
     * @inheritDoc
66
     * @return bool
67
     */
68 1
    public function parseResponse($responseLine, $responseData)
69
    {
70 1
        return $responseLine === 'OK';
71
    }
72
}
73