1 | <?php |
||
25 | class ContentReviewNotificationJob extends AbstractQueuedJob implements QueuedJob |
||
26 | { |
||
27 | /** |
||
28 | * The hour that the first job will be created at (for the next day). All other jobs should |
||
29 | * be triggered around this time too, as the next generation is queued when this job is run. |
||
30 | * |
||
31 | * @var int |
||
32 | * |
||
33 | * @config |
||
34 | */ |
||
35 | private static $first_run_hour = 9; |
||
36 | |||
37 | /** |
||
38 | * The hour at which to run these jobs. |
||
39 | * |
||
40 | * @var int |
||
41 | * |
||
42 | * @config |
||
43 | */ |
||
44 | private static $next_run_hour = 9; |
||
45 | |||
46 | /** |
||
47 | * The minutes past the hour (see above) at which to run these jobs. |
||
48 | * |
||
49 | * @var int |
||
50 | * |
||
51 | * @config |
||
52 | */ |
||
53 | private static $next_run_minute = 0; |
||
54 | |||
55 | /** |
||
56 | * The number of days to skip between job runs (1 means run this job every day, |
||
57 | * 2 means run it every second day etc). |
||
58 | * |
||
59 | * @var int |
||
60 | * |
||
61 | * @config |
||
62 | */ |
||
63 | private static $next_run_in_days = 1; |
||
64 | |||
65 | /** |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getTitle() |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getJobType() |
||
82 | |||
83 | public function process() |
||
93 | |||
94 | /** |
||
95 | * Queue up the next job to run. |
||
96 | */ |
||
97 | protected function queueNextRun() |
||
115 | } |
||
116 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.