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

Schedule::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
4
namespace Pheanstalk\Structure;
5
6
7
class Schedule
8
{
9
    const FAILURE_TYPE_CONTINUE = "CONTINUE";
10
    const FAILURE_TYPE_SUSPEND = "SUSPEND";
11
12
    /** @var int|null $id */
13
    protected $id;
14
15
    /** @var bool $active */
16
    protected $active;
17
18
    /** @var string|null $comment */
19
    protected $comment;
20
21
    /** @var string|null $host */
22
    protected $host;
23
24
    /** @var string|null $node */
25
    protected $node;
26
27
    /** @var string|null $node */
28
    protected $onFailure;
29
30
    /** @var TimeSchedule $schedule */
31
    protected $schedule;
32
33
    /** @var string|null $user */
34
    protected $user;
35
36
    /** @var int $workflow */
37
    protected $workflow;
38
39 1
    public function __construct(
40
        int $workflow,
41
        TimeSchedule $schedule,
42
        $onFailure = self::FAILURE_TYPE_CONTINUE,
43
        $active = true,
44
        $comment = null,
45
        $user = null,
46
        $host = null,
47
        $node = "any"
48
    ) {
49 1
        $this->workflow = $workflow;
50 1
        $this->schedule = $schedule;
51 1
        $this->onFailure = $onFailure;
52 1
        $this->active = $active;
53 1
        $this->comment = $comment;
54 1
        $this->user = $user;
55 1
        $this->host = $host;
56 1
        $this->node = $node;
57
    }
58
59
    /**
60
     * @return int|null
61
     */
62 1
    public function getId(): ?int
63
    {
64 1
        return $this->id;
65
    }
66
67
    /**
68
     * @param int|null $id
69
     *
70
     * @return Schedule
71
     */
72 1
    public function setId(?int $id): Schedule
73
    {
74 1
        $this->id = $id;
75 1
        return $this;
76
    }
77
78
    /**
79
     * @return bool
80
     */
81 1
    public function isActive(): bool
82
    {
83 1
        return $this->active;
84
    }
85
86
    /**
87
     * @param bool $active
88
     *
89
     * @return Schedule
90
     */
91
    public function setActive(bool $active): Schedule
92
    {
93
        $this->active = $active;
94
        return $this;
95
    }
96
97
    /**
98
     * @return string|null
99
     */
100 1
    public function getComment(): ?string
101
    {
102 1
        return $this->comment;
103
    }
104
105
    /**
106
     * @param string|null $comment
107
     *
108
     * @return Schedule
109
     */
110
    public function setComment(?string $comment): Schedule
111
    {
112
        $this->comment = $comment;
113
        return $this;
114
    }
115
116
    /**
117
     * @return string|null
118
     */
119
    public function getHost(): ?string
120
    {
121
        return $this->host;
122
    }
123
124
    /**
125
     * @param string|null $host
126
     *
127
     * @return Schedule
128
     */
129
    public function setHost(?string $host): Schedule
130
    {
131
        $this->host = $host;
132
        return $this;
133
    }
134
135
    /**
136
     * @return string|null
137
     */
138 1
    public function getNode(): ?string
139
    {
140 1
        return $this->node;
141
    }
142
143
    /**
144
     * @param string|null $node
145
     *
146
     * @return Schedule
147
     */
148
    public function setNode(?string $node): Schedule
149
    {
150
        $this->node = $node;
151
        return $this;
152
    }
153
154
    /**
155
     * @return string|null
156
     */
157 1
    public function getOnFailure(): ?string
158
    {
159 1
        return $this->onFailure;
160
    }
161
162
    /**
163
     * @param string|null $onFailure
164
     *
165
     * @return Schedule
166
     */
167
    public function setOnFailure(?string $onFailure): Schedule
168
    {
169
        $this->onFailure = $onFailure;
170
        return $this;
171
    }
172
173
    /**
174
     * @return TimeSchedule
175
     */
176 1
    public function getSchedule(): TimeSchedule
177
    {
178 1
        return $this->schedule;
179
    }
180
181
    /**
182
     * @param TimeSchedule $schedule
183
     *
184
     * @return Schedule
185
     */
186
    public function setSchedule(TimeSchedule $schedule): Schedule
187
    {
188
        $this->schedule = $schedule;
189
        return $this;
190
    }
191
192
    /**
193
     * @return string|null
194
     */
195
    public function getUser(): ?string
196
    {
197
        return $this->user;
198
    }
199
200
    /**
201
     * @param string|null $user
202
     *
203
     * @return Schedule
204
     */
205
    public function setUser(?string $user): Schedule
206
    {
207
        $this->user = $user;
208
        return $this;
209
    }
210
211
    /**
212
     * @return int
213
     */
214 1
    public function getWorkflow(): int
215
    {
216 1
        return $this->workflow;
217
    }
218
219
    /**
220
     * @param int $workflow
221
     *
222
     * @return Schedule
223
     */
224
    public function setWorkflow(int $workflow): Schedule
225
    {
226
        $this->workflow = $workflow;
227
        return $this;
228
    }
229
230
}