Test Failed
Pull Request — master (#1)
by Sebastiaan
03:46
created

Event::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1

1 Method

Rating   Name   Duplication   Size   Complexity  
Event::hour() 0 1 ?
1
<?php
2
3
namespace Basebuilder\Scheduling;
4
5
use Cron\CronExpression;
6
7
interface Event
8
{
9
    /**
10
     * @return string
11
     */
12
    public function __toString();
13
14
    /**
15
     * @param string $description
16
     * @return $this
17
     */
18
    public function describe($description);
19
20
    /**
21
     * Run the given event.
22
     *
23
     * @return mixed
24
     */
25
    public function run();
26
27
    /**
28
     * Schedule the event to run between start and end time.
29
     *
30
     * @param  string  $startTime
31
     * @param  string  $endTime
32
     * @return $this
33
     */
34
    public function between($startTime, $endTime);
35
36
    /**
37
     * Schedule the event to not run between start and end time.
38
     *
39
     * @param  string  $startTime
40
     * @param  string  $endTime
41
     * @return $this
42
     */
43
    public function notBetween($startTime, $endTime);
44
45
    /**
46
     * Set the timezone the date should be evaluated on.
47
     *
48
     * @return $this
49
     */
50
    public function timezone(\DateTimeZone $timezone);
51
52
    /**
53
     * Determine if the given event should run based on the Cron expression.
54
     *
55
     * @return bool
56
     */
57
    public function isDue();
58
59
    /**
60
     * The Cron expression representing the event's frequency.
61
     *
62
     * @param  string  $expression
63
     * @return $this
64
     */
65
    public function cron(/* string */ $expression);
66
67
    /**
68
     * @return CronExpression
69
     */
70
    public function getCronExpression();
71
72
    /**
73
     * Change the minute when the job should run (0-59, *, *\/2 etc)
74
     *
75
     * @param  string|int $minute
76
     * @return $this
77
     */
78
    public function minute($minute);
79
80
    /**
81
     * Schedule the event to run every minute.
82
     *
83
     * @return $this
84
     */
85
    public function everyMinute();
86
87
    /**
88
     * Schedule this event to run every 5 minutes
89
     *
90
     * @return Event
91
     */
92
    public function everyFiveMinutes();
93
94
    /**
95
     * Schedule the event to run every N minutes
96
     *
97
     * @param  int $n
98
     * @return $this
99
     */
100
    public function everyNMinutes(/* int */ $n);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $n. Configured minimum length is 2.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
101
102
    /**
103
     * Set the hour when the job should run (0-23, *, *\/2, etc)
104 20
     *
105
     * @param  string|int $hour
106 20
     * @return Event
107
     */
108 20
    public function hour($hour);
109 20
110
    /**
111
     * Schedule the event to run hourly.
112
     *
113
     * @return $this
114
     */
115
    public function hourly();
116
117
    /**
118
     * Schedule the event to run daily.
119
     *
120
     * @return $this
121
     */
122
    public function daily();
123
124
    /**
125
     * Schedule the event to run daily at a given time (10:00, 19:30, etc).
126
     *
127
     * @param  string  $time
128
     * @return $this
129
     */
130
    public function dailyAt(/* string */ $time);
131
132 5
    /**
133
     * Set the days of the week the command should run on.
134 5
     *
135 5
     * @param  array|mixed  $days
136 5
     * @return $this
137
     */
138
    public function days($days);
139 5
140
    /**
141 5
     * Schedule the event to run only on weekdays.
142
     *
143 5
     * @return $this
144 1
     */
145 1
    public function weekdays();
146
147 5
    /**
148 1
     * Schedule the event to run only on Mondays.
149 1
     *
150
     * @return $this
151 5
     */
152 5
    public function mondays();
153 5
154
    /**
155 5
     * Schedule the event to run only on Tuesdays.
156
     *
157 5
     * @return $this
158
     */
159 5
    public function tuesdays();
160
161
    /**
162
     * Schedule the event to run only on Wednesdays.
163
     *
164
     * @return $this
165
     */
166
    public function wednesdays();
167
168
    /**
169
     * Schedule the event to run only on Thursdays.
170
     *
171
     * @return $this
172
     */
173
    public function thursdays();
174
175
    /**
176
     * Schedule the event to run only on Fridays.
177
     *
178
     * @return $this
179
     */
180
    public function fridays();
181
182
    /**
183
     * Schedule the event to run only on Saturdays.
184
     *
185
     * @return $this
186
     */
187
    public function saturdays();
188
189
    /**
190
     * Schedule the event to run only on Sundays.
191
     *
192
     * @return $this
193
     */
194
    public function sundays();
195
196
    /**
197
     * Schedule the event to run weekly.
198
     *
199
     * @return $this
200
     */
201
    public function weekly();
202
203
    /**
204
     * Schedule the event to run weekly on a given day and time.
205
     *
206
     * @param  int  $day
207
     * @param  string  $time
208
     * @return $this
209
     */
210
    public function weeklyOn($day, $time = '0:0');
211
212
    /**
213
     * Schedule the event to run monthly.
214
     *
215
     * @return $this
216
     */
217
    public function monthly();
218
219
    /**
220
     * Schedule the event to run monthly on a given day and time.
221
     *
222
     * @param int  $day
223
     * @param string  $time
224
     * @return $this
225
     */
226
    public function monthlyOn($day = 1, $time = '0:0');
227
228
    /**
229
     * Schedule the event to run quarterly.
230
     *
231
     * @return $this
232
     */
233
    public function quarterly();
234
235
    /**
236
     * Schedule the event to run yearly.
237
     *
238
     * @return $this
239
     */
240
    public function yearly();
241
242
    /**
243
     * Register a callback to further filter the schedule.
244
     *
245
     * @param  callable  $callback
246
     * @return $this
247
     */
248
    public function when(callable $callback);
249
250
    /**
251
     * Register a callback to further filter the schedule.
252
     *
253
     * @param  callable  $callback
254
     * @return $this
255
     */
256
    public function skip(callable $callback);
257
258
    /**
259
     * Register a callback to be called before the operation.
260
     *
261
     * @param callable $callback
262
     * @return $this
263
     */
264
    public function before(callable $callback);
265
266
    /**
267
     * Register a callback to be called after the operation.
268
     *
269
     * @param  callable  $callback
270
     * @return $this
271
     */
272
    public function after(callable $callback);
273
}
274