Files
Piwigo/include/smarty/src/Extension/CallbackWrapper.php
T
Linty 1be0527523 issue #2405 update smarty
and made Piwigo compatible with smarty 5.x
2025-09-17 12:05:48 +02:00

35 lines
616 B
PHP

<?php
namespace Smarty\Extension;
use Smarty\Exception;
class CallbackWrapper {
/**
* @var callback
*/
private $callback;
/**
* @var string
*/
private $modifierName;
/**
* @param string $modifierName
* @param callback $callback
*/
public function __construct(string $modifierName, $callback) {
$this->callback = $callback;
$this->modifierName = $modifierName;
}
public function handle(...$params) {
try {
return ($this->callback)(...$params);
} catch (\ArgumentCountError $e) {
throw new Exception("Invalid number of arguments to modifier " . $this->modifierName);
}
}
}