32 lines
768 B
PHP
32 lines
768 B
PHP
<?php
|
|
namespace Makai;
|
|
|
|
class TemplateSelf {
|
|
public function __construct(
|
|
private array $members = [],
|
|
?TemplateSelf $inherit = null
|
|
) {
|
|
if($inherit !== null)
|
|
$this->members += $inherit->members;
|
|
}
|
|
|
|
public function __get(string $name): mixed {
|
|
return $this->members[$name];
|
|
}
|
|
|
|
public function __set(string $name, mixed $value): void {
|
|
$this->members[$name] = $value;
|
|
}
|
|
|
|
public function __isset(string $name): bool {
|
|
return isset($this->members[$name]);
|
|
}
|
|
|
|
public function __unset(string $name): void {
|
|
unset($this->members[$name]);
|
|
}
|
|
|
|
public function __call(string $name, array $args): mixed {
|
|
return ($this->members[$name])(...$args);
|
|
}
|
|
}
|