diff --git a/src/Potter/Template/Engine/Aware/TemplateEngineAwareTrait.php b/src/Potter/Template/Engine/Aware/TemplateEngineAwareTrait.php new file mode 100644 index 0000000..83472cb --- /dev/null +++ b/src/Potter/Template/Engine/Aware/TemplateEngineAwareTrait.php @@ -0,0 +1,55 @@ +get(self::TEMPLATE_ENGINE); + } + + abstract public function has(string $key): bool; + + final public function hasTemplateEngine(): bool + { + return $this->has(self::TEMPLATE_ENGINE); + } + + abstract protected function set(string $key, mixed $value): mixed; + + final public function setTemplateEngine(TemplateEngineInterface $templateEngine): TemplateEngineInterface + { + return $this->set(self::TEMPLATE_ENGINE, $templateEngine); + } + + abstract protected function unset(string $key): void; + + final public function unsetTemplateEngine(): void + { + $this->unset(self::TEMPLATE_ENGINE); + } + + abstract public function with(string $key, mixed $value): AwareInterface; + + final public function withTemplateEngine(TemplateEngineInterface $templateEngine): TemplateEngineAwareInterface + { + return $this->with(self::TEMPLATE_ENGINE, $templateEngine); + } + + abstract public function without(string $key): AwareInterface; + + final public function withoutTemplateEngine(): TemplateEngineAwareInterface + { + return $this->without(self::TEMPLATE_ENGINE); + } +}