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