<?php
/**
 * Classe de base pour le retour de status.
 * 
 * @author Olivier Arteau
 */

class BasicStatus implements StatusObject {
    private $message = null;
    
    private static $emptyInstance = null;
    
    public static $EMPTY_STATUS = 0;
    public static $NEW_STATUS = 1;
    
    public function __construct($message) {
    	$this->message = $message;
    }
    
    public static function getInstance($type) {
    	switch ($type) {
    		case BasicStatus::$EMPTY_STATUS :
    			if (self::$emptyInstance == null)
    				self::$emptyInstance = new BasicStatus('');
    			return self::$emptyInstance;
    		case BasicStatus::$NEW_STATUS :
	    		return new BasicStatus('');
    	}
    }
    
    public function toString() {
    	return $this->message;
    }
    
    
    public function getStatus() {
    	return $this->message;
    }
}
?>