* @param portfolio_caller_base $caller portfolio caller (passed by reference)
* @param string $callercomponent the name of the callercomponent
*/
- public function __construct(&$instance, &$caller, $callercomponent) {
- $this->instance =& $instance;
- $this->caller =& $caller;
+ public function __construct($instance, portfolio_caller_base $caller, $callercomponent) {
+ $this->instance = $instance;
+ $this->caller = $caller;
if ($instance) {
$this->instancefile = 'portfolio/' . $instance->get('plugin') . '/lib.php';
$this->instance->set('exporter', $this);
throw new portfolio_button_exception('nocallbackfile', 'portfolio', '', $component);
}
- if (!is_null($class) && !class_exists($class)) {
- throw new portfolio_button_exception('nocallbackclass', 'portfolio', '', $class);
+ if (!is_null($class)) {
+ // If class is specified, check it exists and extends portfolio_caller_base.
+ if (!class_exists($class) || !is_subclass_of($class, 'portfolio_caller_base')) {
+ throw new portfolio_button_exception('nocallbackclass', 'portfolio', '', $class);
+ }
}
}