PageRenderTime 54ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/libraries/joomla/event/event.php

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