1 <?php
2 /**
3 * @package Joomla.Legacy
4 * @subpackage Base
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Abstract observer class to implement the observer design pattern
14 *
15 * @since 1.5
16 * @deprecated 2.5
17 */
18 abstract class JObserver extends JObject
19 {
20 /**
21 * Event object to observe.
22 *
23 * @var object
24 * @since 1.5
25 * @deprecated 2.5
26 */
27 protected $_subject = null;
28
29 /**
30 * Constructor
31 *
32 * @param object &$subject The object to observe.
33 *
34 * @since 1.5
35 * @deprecated 2.5
36 */
37 public function __construct(&$subject)
38 {
39 // Register the observer ($this) so we can be notified
40 $subject->attach($this);
41
42 // Set the subject to observe
43 $this->_subject = &$subject;
44 }
45
46 /**
47 * Method to update the state of observable objects
48 *
49 * @param array &$args An array of arguments to pass to the listener.
50 *
51 * @return mixed
52 *
53 * @since 1.5
54 * @deprecated 2.5
55 */
56 abstract public function update(&$args);
57 }
58