madlisp/src/Func.php
2020-06-01 20:19:26 +07:00

32 lines
528 B
PHP

<?php
namespace MadLisp;
use Closure;
abstract class Func
{
protected Closure $closure;
protected ?string $doc;
public function __construct(Closure $closure, ?string $doc = null)
{
$this->closure = $closure;
$this->doc = $doc;
}
public function getClosure(): Closure
{
return $this->closure;
}
public function getDoc(): ?string
{
return $this->doc;
}
public function call(array $args)
{
return ($this->closure)(...$args);
}
}