|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pheanstalk\Command; |
|
4
|
|
|
|
|
5
|
|
|
use Pheanstalk\ResponseParser; |
|
6
|
|
|
use Pheanstalk\Structure\Schedule; |
|
7
|
|
|
use Pheanstalk\Structure\Workflow; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* The 'update' command. |
|
11
|
|
|
* |
|
12
|
|
|
* Update an existing Schedule. |
|
13
|
|
|
* |
|
14
|
|
|
* @author Valentin Corre |
|
15
|
|
|
* @package Pheanstalk |
|
16
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php |
|
17
|
|
|
*/ |
|
18
|
|
|
class UpdateScheduleCommand extends AbstractCommand implements ResponseParser |
|
19
|
|
|
{ |
|
20
|
|
|
/** @var Workflow $workflow */ |
|
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 'edit'; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @inheritDoc |
|
49
|
|
|
*/ |
|
50
|
1 |
|
public function getFilters(): array |
|
51
|
|
|
{ |
|
52
|
|
|
return [ |
|
53
|
1 |
|
'id' => $this->schedule->getId(), |
|
54
|
1 |
|
'workflow_id' => $this->schedule->getWorkflow(), |
|
|
|
|
|
|
55
|
1 |
|
'schedule' => $this->schedule->getSchedule()->__toString(), |
|
|
|
|
|
|
56
|
1 |
|
'onfailure' => $this->schedule->getOnFailure(), |
|
|
|
|
|
|
57
|
1 |
|
'user' => $this->schedule->getUser(), |
|
|
|
|
|
|
58
|
1 |
|
'host' => $this->schedule->getHost(), |
|
|
|
|
|
|
59
|
1 |
|
'active' => $this->schedule->isActive(), |
|
|
|
|
|
|
60
|
1 |
|
"comment" => $this->schedule->getComment(), |
|
61
|
1 |
|
'node' => $this->schedule->getNode() |
|
|
|
|
|
|
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->schedule; |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..