aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/flexi/PhpTemplate.php15
-rw-r--r--lib/flexi/Template.php2
-rw-r--r--tests/unit/lib/flexi/FactoryTest.php2
3 files changed, 7 insertions, 12 deletions
diff --git a/lib/flexi/PhpTemplate.php b/lib/flexi/PhpTemplate.php
index 8110b50..4eb0da1 100644
--- a/lib/flexi/PhpTemplate.php
+++ b/lib/flexi/PhpTemplate.php
@@ -17,20 +17,15 @@ class PhpTemplate extends Template
* @return string A string representing the rendered presentation.
* @throws TemplateNotFoundException
*/
- public function _render(): string
+ protected function _render(): string
{
extract($this->get_attributes());
# include template, parse it and get output
- try {
- ob_start();
- require $this->template;
- $content_for_layout = ob_get_contents();
- } catch (\Error $e) {
- throw new TemplateNotFoundException(previous: $e);
- } finally {
- ob_end_clean();
- }
+ ob_start();
+ require $this->template;
+ $content_for_layout = ob_get_contents();
+ ob_end_clean();
# include layout, parse it and get output
if (isset($this->layout)) {
diff --git a/lib/flexi/Template.php b/lib/flexi/Template.php
index d5c0310..44eefbe 100644
--- a/lib/flexi/Template.php
+++ b/lib/flexi/Template.php
@@ -18,7 +18,7 @@ abstract class Template
*
* @return string A string representing the rendered presentation.
*/
- abstract public function _render(): string;
+ abstract protected function _render(): string;
protected array $attributes = [];
protected Template|null $layout = null;
diff --git a/tests/unit/lib/flexi/FactoryTest.php b/tests/unit/lib/flexi/FactoryTest.php
index 2df9f6a..f8b9b87 100644
--- a/tests/unit/lib/flexi/FactoryTest.php
+++ b/tests/unit/lib/flexi/FactoryTest.php
@@ -108,7 +108,7 @@ final class FactoryTestCase extends \Codeception\Test\Unit
public function testShouldRespondToAddedHandlers()
{
$handler = new class('', $this->factory) extends Flexi\Template {
- public function _render(): string
+ protected function _render(): string
{
return '';
}