optimize views

This commit is contained in:
Dennis Eichhorn 2022-05-01 22:05:01 +02:00
parent 35d13cd7db
commit 8c865bb0aa
2 changed files with 9 additions and 4 deletions

View File

@ -77,7 +77,7 @@ class View extends ViewAbstract
* @var null|string
* @since 1.0.0
*/
protected ?string $theme = null;
public ?string $theme = null;
/**
* Module name.
@ -85,7 +85,7 @@ class View extends ViewAbstract
* @var null|string
* @since 1.0.0
*/
protected ?string $module = null;
public ?string $module = null;
/**
* Constructor.

View File

@ -32,7 +32,7 @@ abstract class ViewAbstract implements RenderableInterface
* @var string
* @since 1.0.0
*/
private const BASE_PATH = __DIR__ . '/../..';
protected const BASE_PATH = __DIR__ . '/../..';
/**
* Output is buffered
@ -261,6 +261,11 @@ abstract class ViewAbstract implements RenderableInterface
* @since 1.0.0
*/
public function render(...$data) : string
{
return $this->renderTemplate($this->template, ...$data);
}
protected function renderTemplate(string $template, ...$data) : string
{
$ob = '';
@ -269,7 +274,7 @@ abstract class ViewAbstract implements RenderableInterface
\ob_start();
}
$path = $this->template;
$path = $template;
if (!\is_file($path)) {
return '';
}