* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBObserver'); /** * Subject Observer: Obserable Interface * * * @version 0.1.0 * @package WB * @subpackage base */ interface WBObserver_Observable { /** * list of observer * @var array */ //protected $observers = array(); /** * receive unique id of this object * * Usually this method will be derived from WBStdClass * * @see WBStdClass * @return string onject id */ public function getObjectId(); /** * attach observer * * @param WBObserver $observer */ public function attach(WBObserver $observer); /* { $this->observers[$observer->getObjectId()] = $observer; //$this->observers[] = $observer; } */ /** * detach observer * * @param WBObserver $observer */ public function detach(WBObserver $observer); /* { unset($this->observers[$observer->getObjectId()]); //$this->observers = array_diff($this->observers, array($observer)); } */ /** * notify observer * */ public function notify(); /* { foreach ($this->observers as $o) { $o->update($this); } } */ } ?>