<?php
class CronTick extends Tick {
public function __construct($parServerTickNumber, $parRunnable, $parHourInTheDayForRun) {
parent::__construct($parServerTickNumber, 3600*1000, true);
$this->hourInTheDayForRun = $parHourInTheDayForRun;
$this->runnable = $parRunnable;
}
public function getName() {
return $this->runnable->getName();
}
public function run() {
$locHour = date('G');
Log::info("clock is $locHour hour, tick is at $this->hourInTheDayForRun");
if($locHour == $this->hourInTheDayForRun) {
$this->runnable->run();
}
}
}
?>