3 * Listener for HTTP_Request and HTTP_Response objects
\r
5 * PHP versions 4 and 5
\r
9 * Copyright (c) 2002-2007, Richard Heyes
\r
10 * All rights reserved.
\r
12 * Redistribution and use in source and binary forms, with or without
\r
13 * modification, are permitted provided that the following conditions
\r
16 * o Redistributions of source code must retain the above copyright
\r
17 * notice, this list of conditions and the following disclaimer.
\r
18 * o Redistributions in binary form must reproduce the above copyright
\r
19 * notice, this list of conditions and the following disclaimer in the
\r
20 * documentation and/or other materials provided with the distribution.
\r
21 * o The names of the authors may not be used to endorse or promote
\r
22 * products derived from this software without specific prior written
\r
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
\r
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
\r
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
\r
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
\r
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
\r
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
\r
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
\r
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
\r
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
38 * @package HTTP_Request
\r
39 * @author Alexey Borzov <avb@php.net>
\r
40 * @copyright 2002-2007 Richard Heyes
\r
41 * @license http://opensource.org/licenses/bsd-license.php New BSD License
\r
42 * @version CVS: $Id: Listener.php,v 1.3 2007/05/18 10:33:31 avb Exp $
\r
43 * @link http://pear.php.net/package/HTTP_Request/
\r
47 * Listener for HTTP_Request and HTTP_Response objects
\r
49 * This class implements the Observer part of a Subject-Observer
\r
53 * @package HTTP_Request
\r
54 * @author Alexey Borzov <avb@php.net>
\r
55 * @version Release: 1.4.4
\r
57 class HTTP_Request_Listener
\r
60 * A listener's identifier
\r
66 * Constructor, sets the object's identifier
\r
70 function HTTP_Request_Listener()
\r
72 $this->_id = md5(uniqid('http_request_', 1));
\r
77 * Returns the listener's identifier
\r
89 * This method is called when Listener is notified of an event
\r
92 * @param object an object the listener is attached to
\r
93 * @param string Event name
\r
94 * @param mixed Additional data
\r
97 function update(&$subject, $event, $data = null)
\r
99 echo "Notified of event: '$event'\n";
\r
100 if (null !== $data) {
\r
101 echo "Additional data: ";
\r