FRED™  3.0
FRED™: Framework for Rapid and Easy Development
Job.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Rsi\Fred\Worker;
4 
5 class Job extends \Rsi\Thing{
6 
7  public $id = null;
8  public $time = null;
9  public $interval = null;
10  public $maxTime = null;
11  public $groupId = null;
12  public $groupMaxCount = null;
13 
14  protected $_worker = null;
15  protected $_config = null;
16 
17  public function __construct($worker,$id,$config,$time,$interval,$max_time){
18  $this->_worker = $worker;
19  $this->id = $id;
20  $this->time = $time;
21  $this->interval = $interval;
22  $this->maxTime = $max_time;
23  $this->configure($this->_config = $config);
24  }
25 
26  public function execute($timer_id){
27  }
28 
29  public function overdue(){
30  if(!$this->time) return null;
31  if($this->maxTime) return $this->time + $this->maxTime < time();
32  if($this->interval && (substr($this->interval,0,1) != '@')) return strtotime($this->interval,$this->time) < time();
33  return null;
34  }
35 
36  protected function getNextTime(){
37  return $this->interval
38  ? (substr($this->interval,0,1) == '@' ? strtotime(substr($this->interval,1)) : strtotime($this->interval,$this->time))
39  : false;
40  }
41 
42 }
Rsi\Thing
Basic object.
Definition: Thing.php:13
Rsi\Fred\Worker\Job\$_worker
$_worker
Definition: Job.php:14
Rsi\Fred\Worker\Job\$interval
$interval
Definition: Job.php:9
Rsi\Fred\Worker\Job\getNextTime
getNextTime()
Definition: Job.php:36
Rsi\Fred\Worker\Job\$maxTime
$maxTime
Definition: Job.php:10
Rsi\Fred\Worker\Job\$_config
$_config
Definition: Job.php:15
Rsi\Fred\Worker\Job\$id
$id
Definition: Job.php:7
Rsi\Fred\Worker\Job\__construct
__construct($worker, $id, $config, $time, $interval, $max_time)
Definition: Job.php:17
Rsi\Fred\Worker\Job\$time
$time
Definition: Job.php:8
Rsi\Thing\configure
configure($config)
Configure the object.
Definition: Thing.php:55
Rsi\Fred\Worker
Rsi\Fred\Worker\Job\overdue
overdue()
Definition: Job.php:29
Rsi\Fred\Worker\Job\execute
execute($timer_id)
Definition: Job.php:26
Rsi\Fred\Worker\Job\$groupId
$groupId
Definition: Job.php:11
Rsi\Fred\Worker\Job
Definition: Job.php:5
Rsi\Fred\Worker\Job\$groupMaxCount
$groupMaxCount
Definition: Job.php:12