<?php
/**
* Abstract model controller for all the 'manager' classes.
*
* @package SGL
* @author Demian Turner <demian@phpkitchen.com>
* @abstract
*/
class SGL_Observer
{
public function update($observable) {}
}
/**
* Abstract model controller for all the 'manager' classes.
*
* @package SGL
* @author Demian Turner <demian@phpkitchen.com>
* @abstract
*/
class SGL_Observable
{
var $aObservers = array();
public function attach($observer)
{
$this->aObservers[] = $observer;
}
public function detach($observer)
{
$this->aObservers = array_diff($this->aObservers, array($observer));
}
public function notify()
{
foreach ($this->aObservers as $obs) {
$returnVal = $obs->update($this);
if (SGL::isError($returnVal)) {
SGL::raiseError($returnVal->getMessage(), $returnVal->getCode());
}
}
}
public function getStatus() {}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez