2 declare(strict_types
=1);
4 use wcf\system\exception\SystemException
;
7 * Represents a callback
9 * @author Tim Duesterhus
10 * @copyright 2001-2018 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package WoltLabSuite\Core\System
13 * @deprecated since 3.0, use callables and `callable` type hint directly
15 final class Callback
{
17 * encapsulated callback
20 private $callback = null;
23 * Creates new instance of Callback.
25 * @param callback $callback
26 * @throws SystemException
28 public function __construct($callback) {
29 if (!is_callable($callback)) {
30 throw new SystemException('Given callback is not callable.');
33 $this->callback
= $callback;
37 * Invokes our callback. All parameters are simply passed through.
41 public function __invoke() {
42 return call_user_func_array($this->callback
, func_get_args());