![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/gositeme.com/public_html/whmcs/vendor/league/plates/src/Template/ |
<?php
namespace League\Plates\Template;
use League\Plates\Extension\ExtensionInterface;
use LogicException;
/**
* A template function.
*/
class Func
{
/**
* The function name.
* @var string
*/
protected $name;
/**
* The function callback.
* @var callable
*/
protected $callback;
/**
* Create new Func instance.
* @param string $name
* @param callable $callback
*/
public function __construct($name, $callback)
{
$this->setName($name);
$this->setCallback($callback);
}
/**
* Set the function name.
* @param string $name
* @return Func
*/
public function setName($name)
{
if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $name) !== 1) {
throw new LogicException(
'Not a valid function name.'
);
}
$this->name = $name;
return $this;
}
/**
* Get the function name.
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set the function callback
* @param callable $callback
* @return Func
*/
public function setCallback($callback)
{
if (!is_callable($callback, true)) {
throw new LogicException(
'Not a valid function callback.'
);
}
$this->callback = $callback;
return $this;
}
/**
* Get the function callback.
* @return callable
*/
public function getCallback()
{
return $this->callback;
}
/**
* Call the function.
* @param Template $template
* @param array $arguments
* @return mixed
*/
public function call(Template $template = null, $arguments = array())
{
if (is_array($this->callback) and
isset($this->callback[0]) and
$this->callback[0] instanceof ExtensionInterface
) {
$this->callback[0]->template = $template;
}
return call_user_func_array($this->callback, $arguments);
}
}