Passed
Pull Request — master (#28)
by Valentin
04:18
created

DeleteScheduleCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 8
c 1
b 0
f 0
dl 0
loc 45
ccs 10
cts 10
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponseParser() 0 3 1
A getAction() 0 3 1
A getGroup() 0 3 1
A __construct() 0 3 1
A getFilters() 0 4 1
1
<?php
2
3
namespace Pheanstalk\Command;
4
5
use Pheanstalk\Parser\RequestOkResponseParser;
6
use Pheanstalk\Structure\Schedule;
7
use Pheanstalk\Structure\Workflow;
8
9
/**
10
 * The 'deleteSchedule' command.
11
 *
12
 * Permanently deletes an already-reserved job.
13
 *
14
 * @author  Valentin Corre
15
 * @package Pheanstalk
16
 * @license http://www.opensource.org/licenses/mit-license.php
17
 */
18
class DeleteScheduleCommand extends AbstractCommand
19
{
20
    /** @var Schedule $schedule */
21
    private $schedule;
22
23
    /**
24
     * @param Schedule $schedule
25
     */
26 1
    public function __construct(Schedule $schedule)
27
    {
28 1
        $this->schedule = $schedule;
29
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34 1
    public function getGroup(): string
35
    {
36 1
        return 'workflow_schedule';
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42 1
    public function getAction(): string
43
    {
44 1
        return 'delete';
45
    }
46
47
    /**
48
     * @inheritDoc
49
     */
50 1
    public function getFilters(): array
51
    {
52
        return [
53 1
            'id' => $this->schedule->getId()
54
        ];
55
    }
56
57
    /**
58
     * @inheritDoc
59
     */
60 1
    public function getResponseParser()
61
    {
62 1
        return new RequestOkResponseParser();
63
    }
64
}
65