<?php
/**
* o------------------------------------------------------------------------------o
* | This package is dual licensed as GPL and a commercial license.               |
* | If you use the code commercially (or if you don't want to be restricted by   |
* | the GPL license), you will need the commercial license. It's only £49 (GBP - |
* | roughly $98 depending on the exchange rate) and helps me out a lot. Thanks.  |
* o------------------------------------------------------------------------------o
*
* © Copyright Richard Heyes
*/

/**
* Listener for HTTP_Request and HTTP_Response objects
*
* PHP versions 4 and 5
*/

/**
* Listener for HTTP_Request and HTTP_Response objects
*
* This class implements the Observer part of a Subject-Observer
* design pattern.
*/
class HTTP_Request_Listener
{
   
/**
    * A listener's identifier
    * @var string
    */
    
var $_id;

   
/**
    * Constructor, sets the object's identifier
    *
    * @access public
    */
    
function HTTP_Request_Listener()
    {
        
$this->_id = md5(uniqid('http_request_', 1));
    }


   
/**
    * Returns the listener's identifier
    *
    * @access public
    * @return string
    */
    
function getId()
    {
        return
$this->_id;
    }


   
/**
    * This method is called when Listener is notified of an event
    *
    * @access   public
    * @param    object  an object the listener is attached to
    * @param    string  Event name
    * @param    mixed   Additional data
    * @abstract
    */
    
function update(&$subject, $event, $data = null)
    {
        echo
"Notified of event: '$event'\n";
        if (
null !== $data) {
            echo
"Additional data: ";
            
var_dump($data);
        }
    }
}
?>