2020-05-31 10:50:29 +00:00
|
|
|
<?php
|
|
|
|
namespace MadLisp;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
|
|
|
|
abstract class Func
|
|
|
|
{
|
|
|
|
protected Closure $closure;
|
2020-06-01 13:19:26 +00:00
|
|
|
protected ?string $doc;
|
2020-12-06 01:26:27 +00:00
|
|
|
protected bool $macro;
|
2020-05-31 10:50:29 +00:00
|
|
|
|
2020-12-06 01:26:27 +00:00
|
|
|
public function __construct(Closure $closure, ?string $doc = null, bool $macro = false)
|
2020-05-31 10:50:29 +00:00
|
|
|
{
|
|
|
|
$this->closure = $closure;
|
2020-06-01 13:19:26 +00:00
|
|
|
$this->doc = $doc;
|
2020-12-06 01:26:27 +00:00
|
|
|
$this->macro = $macro;
|
2020-05-31 10:50:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getClosure(): Closure
|
|
|
|
{
|
|
|
|
return $this->closure;
|
|
|
|
}
|
|
|
|
|
2020-06-01 13:19:26 +00:00
|
|
|
public function getDoc(): ?string
|
|
|
|
{
|
|
|
|
return $this->doc;
|
|
|
|
}
|
|
|
|
|
2020-12-06 01:26:27 +00:00
|
|
|
public function isMacro(): bool
|
|
|
|
{
|
|
|
|
return $this->macro;
|
|
|
|
}
|
|
|
|
|
2020-12-05 03:39:58 +00:00
|
|
|
public function setDoc(?string $val): void
|
|
|
|
{
|
|
|
|
$this->doc = $val;
|
|
|
|
}
|
|
|
|
|
2020-12-03 13:23:26 +00:00
|
|
|
abstract public function call(array $args);
|
2020-05-31 10:50:29 +00:00
|
|
|
}
|