UpdateTubeCommand   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 13
c 1
b 0
f 0
dl 0
loc 60
ccs 16
cts 16
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A parseResponse() 0 3 1
A __construct() 0 3 1
A getAction() 0 3 1
A getFilters() 0 8 1
A getResponseParser() 0 3 1
A getGroup() 0 3 1
1
<?php
2
3
namespace Pheanstalk\Command;
4
5
use Pheanstalk\ResponseParser;
6
use Pheanstalk\Structure\Tube;
7
use Pheanstalk\Structure\Workflow;
8
9
/**
10
 * The 'UpdateTube' command.
11
 *
12
 * Updates an existing tube
13
 *
14
 *
15
 * @author  Valentin Corre
16
 * @package Pheanstalk
17
 * @license http://www.opensource.org/licenses/mit-license.php
18
 */
19
class UpdateTubeCommand extends AbstractCommand implements ResponseParser
20
{
21
22
    /** @var Tube $tube */
23
    private $tube;
24
25
    /**
26
     * Updates an existing tube
27
     *
28
     * @param Workflow    $workflow     The workflow to create
29
     */
30 1
    public function __construct(Tube $tube)
31
    {
32 1
        $this->tube = $tube;
33
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38 1
    public function getGroup(): string
39
    {
40 1
        return 'queue';
41
    }
42
43
    /**
44
     * @inheritDoc
45
     */
46 1
    public function getAction(): string
47
    {
48 1
        return 'edit';
49
    }
50
51
    /**
52
     * @inheritDoc
53
     */
54 1
    public function getFilters(): array
55
    {
56
        return [
57 1
            'id' => $this->tube->getId(),
58 1
            'name' => $this->tube->getName(),
59 1
            "concurrency" => $this->tube->getConcurrency(),
60 1
            'scheduler' => $this->tube->getScheduler(),
61 1
            'dynamic' => $this->tube->getDynamic(),
62
        ];
63
    }
64
65
    /**
66
     * @inheritDoc
67
     */
68 1
    public function getResponseParser()
69
    {
70 1
        return $this;
71
    }
72
73
    /**
74
     * @inheritDoc
75
     */
76 1
    public function parseResponse($responseLine, $responseData)
77
    {
78 1
        return $this->tube;
79
    }
80
}
81