mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-12-31 07:04:05 +00:00
25 lines
374 B
PHP
25 lines
374 B
PHP
|
<?php
|
||
|
namespace MadLisp;
|
||
|
|
||
|
use Closure;
|
||
|
|
||
|
abstract class Func
|
||
|
{
|
||
|
protected Closure $closure;
|
||
|
|
||
|
public function __construct(Closure $closure)
|
||
|
{
|
||
|
$this->closure = $closure;
|
||
|
}
|
||
|
|
||
|
public function getClosure(): Closure
|
||
|
{
|
||
|
return $this->closure;
|
||
|
}
|
||
|
|
||
|
public function call(array $args)
|
||
|
{
|
||
|
return ($this->closure)(...$args);
|
||
|
}
|
||
|
}
|