- md5
- 7d3542f5e2b68855fee3fa0c11d3d702
- sha1
- f3d2488dc07e579701d9c15cb1f0befdd9290c15
- sha256
- 794ac624888303c146c37fbc3726c6898b9462ccb6577c5bf20b87f1f9d1efe3
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010 - 2015 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* Defines an observable event.
*
* This class is based on JEvent as found in Joomla! 3.2.0
*/
abstract class FOFUtilsObservableEvent extends FOFUtilsObject
{
/**
* Event object to observe.
*
* @var object
*/
protected $_subject = null;
/**
* Constructor
*
* @param object &$subject The object to observe.
*/
public function __construct(&$subject)
{
// Register the observer ($this) so we can be notified
$subject->attach($this);
// Set the subject to observe
$this->_subject = &$subject;
}
/**
* Method to trigger events.
* The method first generates the even from the argument array. Then it unsets the argument
* since the argument has no bearing on the event handler.
* If the method exists it is called and returns its return value. If it does not exist it
* returns null.
*
* @param array &$args Arguments
*
* @return mixed Routine return value
*/
public function update(&$args)
{
// First let's get the event from the argument array. Next we will unset the
// event argument as it has no bearing on the method to handle the event.
$event = $args['event'];
unset($args['event']);
/*
* If the method to handle an event exists, call it and return its return
* value. If it does not exist, return null.
*/
if (method_exists($this, $event))
{
return call_user_func_array(array($this, $event), $args);
}
else
{
return null;
}
}
}
The same content is in 37 releases, Joomla 3.4.1-rc to 3.6.2. See them all, or every version of this file.