madlisp/src/Func.php

47 lines
830 B
PHP
Raw Normal View History

<?php
2020-12-14 01:49:07 +00:00
/**
* MadLisp language
* @link http://madlisp.com/
* @copyright Copyright (c) 2020 Pekka Laiho
*/
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-12-06 01:26:27 +00:00
public function __construct(Closure $closure, ?string $doc = null, bool $macro = false)
{
$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;
}
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;
}
public function setDoc(?string $val): void
{
$this->doc = $val;
}
abstract public function call(array $args);
}