HTTP_Request
[ class tree: HTTP_Request ] [ index: HTTP_Request ] [ all elements ]

Source for file Listener.php

Documentation is available at Listener.php

  1. <?php
  2. /**
  3.  * Listener for HTTP_Request and HTTP_Response objects
  4.  *
  5.  * PHP versions 4 and 5
  6.  * 
  7.  * LICENSE:
  8.  *
  9.  * Copyright (c) 2002-2007, Richard Heyes
  10.  * All rights reserved.
  11.  *
  12.  * Redistribution and use in source and binary forms, with or without
  13.  * modification, are permitted provided that the following conditions
  14.  * are met:
  15.  *
  16.  * o Redistributions of source code must retain the above copyright
  17.  *   notice, this list of conditions and the following disclaimer.
  18.  * o Redistributions in binary form must reproduce the above copyright
  19.  *   notice, this list of conditions and the following disclaimer in the
  20.  *   documentation and/or other materials provided with the distribution.
  21.  * o The names of the authors may not be used to endorse or promote
  22.  *   products derived from this software without specific prior written
  23.  *   permission.
  24.  *
  25.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  28.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  29.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  30.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  31.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  32.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  34.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  35.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  36.  *
  37.  * @category    HTTP
  38.  * @package     HTTP_Request
  39.  * @author      Alexey Borzov <avb@php.net>
  40.  * @copyright   2002-2007 Richard Heyes
  41.  * @license     http://opensource.org/licenses/bsd-license.php New BSD License
  42.  * @version     CVS: $Id: Listener.php,v 1.3 2007/05/18 10:33:31 avb Exp $
  43.  * @link        http://pear.php.net/package/HTTP_Request/
  44.  */
  45.  
  46. /**
  47.  * Listener for HTTP_Request and HTTP_Response objects
  48.  *
  49.  * This class implements the Observer part of a Subject-Observer
  50.  * design pattern.
  51.  *
  52.  * @category    HTTP
  53.  * @package     HTTP_Request
  54.  * @author      Alexey Borzov <avb@php.net>
  55.  * @version     Release: 1.4.4
  56.  */
  57. {
  58.    /**
  59.     * A listener's identifier
  60.     * @var string 
  61.     */
  62.     var $_id;
  63.  
  64.    /**
  65.     * Constructor, sets the object's identifier
  66.     *
  67.     * @access public
  68.     */
  69.     function HTTP_Request_Listener()
  70.     {
  71.         $this->_id md5(uniqid('http_request_'1));
  72.     }
  73.  
  74.  
  75.    /**
  76.     * Returns the listener's identifier
  77.     *
  78.     * @access public
  79.     * @return string 
  80.     */
  81.     function getId()
  82.     {
  83.         return $this->_id;
  84.     }
  85.  
  86.  
  87.    /**
  88.     * This method is called when Listener is notified of an event
  89.     *
  90.     * @access   public
  91.     * @param    object  an object the listener is attached to
  92.     * @param    string  Event name
  93.     * @param    mixed   Additional data
  94.     * @abstract
  95.     */
  96.     function update(&$subject$event$data = null)
  97.     {
  98.         echo "Notified of event: '$event'\n";
  99.         if (null !== $data{
  100.             echo "Additional data: ";
  101.             var_dump($data);
  102.         }
  103.     }
  104. }
  105. ?>

Documentation generated on Mon, 17 Nov 2008 09:00:17 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.