class Api_X_Y {
private $_id;
private $_blah_title;
private $_XXXX;
private static $inputParam;
if($inputParam){
}
// Store the single instance of Api_X_Y
private static $Instance;
// Private constructor to limit object instantiation to within the class
private function __construct($id)
{
echo "Test <br />\n";
}
// Getter method for creating/returning the single instance of this class
public static function getInstance($id)
{
if (!self::$Instance)
{
self::$Instance = new self($id);
}
return self::$Instance;
}
public function resetInstance()
{
$this -> _id =NULL;
$this -> _blah_title =NULL;
$this -> _XXXX = NULL;
}
}
?>
Хорошо, я хотел бы изменить код так, чтобы при появлении нового объекта с новым идентификатором он сравнивался с inputParam (который является идентификатором старого объекта), и если он не совпадает, он сбрасывался свойств (открытая функция resetInstance).
Я начал с вставки публичной функции resetInstance и знаю, что должен как-то реализовать оператор IF .....
Кто-нибудь может мне помочь?