Location: PHPKode > scripts > NabiCI > CI/Process.php
<?php
/**
 * abstract class Process
 * 
 * @author Derya Oez
 * @version 1.0
 * @package NabidooCI
 * @abstract
 */

abstract class Process
{	
	/**
	 * The status of the final result from a process, whether successful [=true] or not [=false]
	 * 
	 * @access protected
	 * @var Boolean
	 */
	
	protected $successful=false; 
	
	/**
	 * The status of a process, whether running [=true] or not [=false]
	 * 
	 * @access protected
	 * @var Boolean
	 */
	
	protected $running = false;
	
	/**
	 * The name of a process
	 * 
	 * @access protected
	 * @var String
	 */
	
	protected $name; 
	
	/**
	 * The unformatted end time of a process in seconds
	 * 
	 * @access protected
	 * @var Integer
	 */
	
	protected $endTime;
	
	/**
	 * The unformatted start time of a process in seconds
	 * 
	 * @access protected
	 * @var Integer
	 */
	
	protected $startTime=0;
	
	/**
	 * The calculated and formatted time duration of a running process
	 * 
	 * @access protected
	 * @var String
	 */
	
	
	protected $timeDuration; 
	
	/**
	 * The message is used to show the status of a process e.g. process is running,
	 * if a process is finish, the message will be depending on the result
	 * 
	 * @access protected
	 * @var String
	 */
		
	protected $message = "<font color=green>process is running</font>"; 
	
	
	/**
	 * function __construct()
	 *
	 * @access public
	 */
	public function __construct()
	{
	}

	/**
	 * function run()
	 * 
	 * @access public
	 */
	public function run()
	{
	}
	
	/**
	 * function getSuccessful()
	 * 
	 * @access public
	 * @return String $this->successful
	 */

	public function getSuccessful()
	{
		return $this->successful;
	}

	/**
	 * function getRunning()
	 * 
	 * @access public
	 * @return String $this->running
	 */	

	public function getRunning()
	{
		return $this->running;
	}

	/**
	 * function getName()
	 * 
	 * @access public
	 * @return String $this->name
	 */	
	
	public function getName()
	{
		return $this->name;
	}

	/**
	 * function getEndTime()
	 * 
	 * @access public
	 * @return String $this->endTime
	 */	

	public function getEndTime()
	{
		return $this->endTime;
	}

	/**
	 * function getStartTime()
	 * 
	 * @access public
	 * @return String $this->startTime
	 */	

	public function getStartTime()
	{
		return $this->startTime;
	}

	/**
	 * function getMessage()
	 * 
	 * @access public
	 * @return String $this->message
	 */	
	
	public function getMessage()
	{
		return $this->message;
	}

	/**
	 * function getTimeDuration() returns the duration time of a process, which
	 * is the difference of the end time and start time of a process
	 * 
	 * @access public
	 * @return String $this->timeDuration
	 * time duration of a process
	 */	
	
	public function getTimeDuration()
	{
		  $seconds = $this->endTime - $this->startTime;  
    
		  $days = floor($seconds/60/60/24);  
		  $hours = $seconds/60/60%24;  
		  $mins = $seconds/60%60;  
		  $secs = $seconds%60;  
		    
		  $duration='';  
		  if($days>0) $duration= $duration."$days d ";  
		  if($hours>0) $duration= $duration."$hours h ";  
		  if($mins>0) $duration= $duration."$mins min ";  
		  if($secs>0) $duration= $duration."$secs s ";  
		    
		  $duration = trim($duration);  
		  if($duration==null) $duration = '0 s';  
      
		return $this->timeDuration=$duration;
	}
}
?>
Return current item: NabiCI