<?php

class DaemonTask {

	private $pid;

	private $sheduleType = array('year'=>0, 'month'=>0, 'week'=>0, 'day'=>0, 'hour'=>0, 'minute'=>0, 'second'=>0);

	private $sheduleOffset;

	private $masterPid;



	public function getPid() {
		return $this->pid;
	}

	public function SetPid($pid) {
		$this->pid = $pid;
	}

	public function GetSheduleType() {
		return $this->sheduleType;
	}

	public function SetSheduleType($sheduleType) {
		$this->sheduleType = $sheduleType;
	}

	public function GetSheduleOffset() {
		return $this->sheduleOffset;
	}

	public function SetSheduleOffset($sheduleOffset) {
		$this->sheduleOffset = $sheduleOffset;
	}

	public function GetMasterPid() {
		return $this->masterPid;
	}

	public function SetMasterPid($masterPid) {
		$this->masterPid = $masterPid;
	}



	public function  __construct() {

	}

	public function Run($masterPid) {
		$this->SetMasterPid($masterPid);
		$this->Action();
		$this->ReShedule();
		return true;
	}

	public function Action() {
		return true;
	}


	public function ReShedule() {
		$shedule = $this->GetSheduleType();
		if(isset($shedule['year']) && $shedule['year']>0) {
			//$next = mktime(0,0,0,date("m"),  date("d"),  date("Y")+$shedule['year']);
		}

		return true;
	}


}

?>