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

DeleteTubeCommand   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 9
c 1
b 0
f 0
dl 0
loc 54
ccs 12
cts 12
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilters() 0 4 1
A parseResponse() 0 3 1
A getGroup() 0 3 1
A __construct() 0 3 1
A getAction() 0 3 1
A getResponseParser() 0 3 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