PutCommand::getFilters()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
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\Workflow;
6
7
/**
8
 * The 'put' command.
9
 *
10
 * Inserts a job into the client's currently used tube.
11
 *
12
 * @see UseCommand
13
 *
14
 * @author  Valentin Corre
15
 * @package Pheanstalk
16
 * @license http://www.opensource.org/licenses/mit-license.php
17
 */
18
class PutCommand extends AbstractCommand implements \Pheanstalk\ResponseParser
19
{
20
21
    /** @var Workflow $workflow */
22
    private $workflow;
23
24
    /**
25
     * Puts a workflow in queue.
26
     *
27
     * @param Workflow $workflow     The Workflow
28
     */
29 6
    public function __construct(Workflow $workflow)
30
    {
31 6
        $this->workflow = $workflow;
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37 6
    public function getGroup(): string
38
    {
39 6
        return 'instance';
40
    }
41
42
    /**
43
     * @inheritDoc
44
     */
45 6
    public function getAction(): string
46
    {
47 6
        return 'launch';
48
    }
49
50
    /**
51
     * @inheritDoc
52
     */
53 6
    public function getFilters(): array
54
    {
55
        return [
56 6
            'name' => $this->workflow->getName(),
57
        ];
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63 6
    public function getResponseParser()
64
    {
65 6
        return $this;
66
    }
67
68
    /**
69
     * @inheritDoc
70
     */
71 6
    public function parseResponse($responseLine, $responseData)
72
    {
73 6
        return $responseData['@attributes'];
74
    }
75
}
76