| Total Complexity | 4 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | class Tasks { |
||
| 20 | |||
| 21 | public static function schedule (int $limit = 3) { |
||
| 22 | //execute overdued tasks |
||
| 23 | foreach (self::getOverduedTasks($limit) as $task) { |
||
| 24 | //cast task |
||
| 25 | $task = Task::cast($task); |
||
| 26 | |||
| 27 | //execute task |
||
| 28 | $task->execute(); |
||
| 29 | |||
| 30 | //update last execution timestamp |
||
| 31 | $task->setLastExecution(); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | public static function getOverduedTasks (int $limit = 10) : array { |
||
| 50 | } |
||
| 51 | |||
| 55 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.