1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Observer
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
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Observer updater pattern implementation for Joomla
14 *
15 * @since 3.1.2
16 */
17 interface JObserverUpdaterInterface
18 {
19 /**
20 * Constructor
21 *
22 * @param JObservableInterface $observable The observable subject object
23 *
24 * @since 3.1.2
25 */
26 public function __construct(JObservableInterface $observable);
27
28 /**
29 * Adds an observer to the JObservableInterface instance updated by this
30 * This method can be called fron JObservableInterface::attachObserver
31 *
32 * @param JObserverInterface $observer The observer object
33 *
34 * @return void
35 *
36 * @since 3.1.2
37 */
38 public function attachObserver(JObserverInterface $observer);
39
40 /**
41 * Call all observers for $event with $params
42 *
43 * @param string $event Event name (function name in observer)
44 * @param array $params Params of event (params in observer function)
45 *
46 * @return void
47 *
48 * @since 3.1.2
49 */
50 public function update($event, $params);
51
52 /**
53 * Enable/Disable calling of observers (this is useful when calling parent:: function
54 *
55 * @param boolean $enabled Enable (true) or Disable (false) the observer events
56 *
57 * @return boolean Returns old state
58 *
59 * @since 3.1.2
60 */
61 public function doCallObservers($enabled);
62 }
63