<?php
    
/**
    * o------------------------------------------------------------------------------o
    * | This package is licensed under the Phpguru license 2008. A quick summary is  |
    * | that the code is free to use for non-commercial purposes. For commercial     |
    * | purposes of any kind there is a small license fee to pay. You can read more  |
    * | at:                                                                          |
    * |                  http://www.phpguru.org/static/license.html                  |
    * o------------------------------------------------------------------------------o
    *
    * © Copyright 2008 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);
        }
    }
}
?>