PageRenderTime 36ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/libraries/joomla/event/event.php

https://bitbucket.org/ankursaxena_2/joomla-platform
PHP | 51 lines | 16 code | 4 blank | 31 comment | 2 complexity | f40cf17d2af2ab5c3a1aa61268bc1049 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, BSD-3-Clause
  1. <?php
  2. /**
  3. * @package Joomla.Platform
  4. * @subpackage Event
  5. *
  6. * @copyright Copyright (C) 2005 - 2011 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. jimport('joomla.base.observer');
  11. /**
  12. * JEvent Class
  13. *
  14. * @abstract
  15. * @package Joomla.Platform
  16. * @subpackage Event
  17. * @since 11.1
  18. */
  19. abstract class JEvent extends JObserver
  20. {
  21. /**
  22. * Method to trigger events.
  23. *
  24. * @param array Arguments
  25. *
  26. * @return mixed Routine return value
  27. * @since 11.1
  28. */
  29. public function update(&$args)
  30. {
  31. /*
  32. * First let's get the event from the argument array. Next we will unset the
  33. * event argument as it has no bearing on the method to handle the event.
  34. */
  35. $event = $args['event'];
  36. unset($args['event']);
  37. /*
  38. * If the method to handle an event exists, call it and return its return
  39. * value. If it does not exist, return null.
  40. */
  41. if (method_exists($this, $event)) {
  42. return call_user_func_array(array($this, $event), $args);
  43. } else {
  44. return null;
  45. }
  46. }
  47. }