Source for file Observerable.class.php

Documentation is available at Observerable.class.php

  1. <?php
  2. /**
  3.  * Gumbo Library Framework
  4.  *
  5.  * LICENSE
  6.  * This library is being released under the terms of the New BSD License.  A
  7.  * copy of the license is packaged with the software (LICENSE.txt).  If no
  8.  * copy is found, a copy of the license template can be found at:
  9.  * http://www.opensource.org/licenses/bsd-license.php
  10.  * 
  11.  * @category Gumbo
  12.  * @package Observer
  13.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  14.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  15.  * @author Michael Luster <mluster79@yahoo.com>
  16.  * @link http://sourceforge.net/projects/phpgumbo
  17.  * @version 0.0.1
  18.  */
  19.  
  20. /**
  21.  * Observer Pattern Interface, Observerable
  22.  * 
  23.  * The Observerable is responsible for sending updates to changes to it's state
  24.  * to any Observers.  The Observerable contains important information to other
  25.  * objects in the program.  If any changes are made, it will notify all it's
  26.  * Observers.  It will define the information it passes, and the Observer is
  27.  * responsible for interpretting the data.
  28.  *
  29.  * @category Gumbo
  30.  * @package Observer
  31.  * @copyright Copyright (c) 2007, iBayou, Michael Luster
  32.  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  33.  * @author Michael Luster <mluster79@yahoo.com>
  34.  * @link http://sourceforge.net/projects/phpgumbo
  35.  * @desc Observer Pattern Interface, Observerable
  36.  * @version 0.0.1
  37.  * @see Gumbo_Error
  38.  */
  39.  
  40. gumbo_load ("Interface_Observer");
  41.  
  42.     
  43.     /**
  44.      * Attaches (registers) an Observer to the Observerable
  45.      * @param Gumbo_Interface_Observer $obj 
  46.      */
  47.     public function attach (Gumbo_Interface_Observer $obj);
  48.     
  49.     /**
  50.      * Detach (unregister) an Observer from the Observerable
  51.      * @param Gumbo_Interface_Observer $obj 
  52.      */
  53.     public function detach (Gumbo_Interface_Observer $obj);
  54.     
  55.     /**
  56.      * Notifies the Observers about changes to the Observerable object state
  57.      * 
  58.      * The method will send data to the Observer through the Observer update
  59.      * method.  The supplied arguments will be an array, consisting
  60.      * of a key=>value pairs with data the Observerable wants to
  61.      * pass.  The Observer should provide implementation to parse this
  62.      * information into the necessary values.  The Observerable class should
  63.      * define the type of array data it will be outputting, allowing an
  64.      * Observer to properly parse the information.
  65.      */
  66.     public function notify ();
  67.     
  68. }
  69.  
  70. ?>