Back to HTMLHelper class

Method call

protected static mixed
call
(callable $function, mixed $args)
Function caller method
Parameters
  • callable $function Function or method to call
  • array $args Arguments to be passed to function
Returns
  • mixed Function result or false on error.
Since
  • 1.6
-
  • https://www.php.net/manual/en/function.call-user-func-array.php
  • \InvalidArgumentException
Class: HTMLHelper
Project: Joomla

Method call - Source code

/**
 * Function caller method
 *
 * @param   callable  $function  Function or method to call
 * @param   array     $args      Arguments to be passed to function
 *
 * @return  mixed   Function result or false on error.
 *
 * @link    https://www.php.net/manual/en/function.call-user-func-array.php
 * @since   1.6
 * @throws  \InvalidArgumentException
 */
protected static function call(callable $function, $args)
{
    // PHP 5.3 workaround
    $temp = array();
    foreach ($args as &$arg) {
        $temp[] =& $arg;
    }
    return \call_user_func_array($function, $temp);
}