/libraries/legacy/base/observer.php

https://bitbucket.org/eternaware/joomus · PHP · 60 lines · 12 code · 5 blank · 43 comment · 0 complexity · 120cf421f41a1ef03af6122be90b4c29 MD5 · raw file

  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. defined('JPATH_PLATFORM') or die;
  10. /**
  11. * Abstract observer class to implement the observer design pattern
  12. *
  13. * @package Joomla.Legacy
  14. * @subpackage Base
  15. * @since 11.1
  16. * @deprecated 12.3
  17. * @codeCoverageIgnore
  18. */
  19. abstract class JObserver extends JObject
  20. {
  21. /**
  22. * Event object to observe.
  23. *
  24. * @var object
  25. * @since 11.1
  26. * @deprecated 12.3
  27. */
  28. protected $_subject = null;
  29. /**
  30. * Constructor
  31. *
  32. * @param object &$subject The object to observe.
  33. *
  34. * @since 11.1
  35. * @deprecated 12.3
  36. */
  37. public function __construct(&$subject)
  38. {
  39. // Register the observer ($this) so we can be notified
  40. $subject->attach($this);
  41. // Set the subject to observe
  42. $this->_subject = &$subject;
  43. }
  44. /**
  45. * Method to update the state of observable objects
  46. *
  47. * @param array &$args An array of arguments to pass to the listener.
  48. *
  49. * @return mixed
  50. *
  51. * @since 11.1
  52. * @deprecated 12.3
  53. */
  54. public abstract function update(&$args);
  55. }