Skip to content

Commit

Permalink
Var names refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
joanmon committed Aug 21, 2015
1 parent ad9fc7f commit 9824aea
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/TplEngine/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class View
/**
* @var array
*/
private static $extend = [];
private static $templateHeap = [];
/**
* @var string
*/
private static $content = '';
private static $contentToRender = '';
/**
* @var array
*/
Expand All @@ -36,7 +36,7 @@ public static function setBasePath($basePath)
*/
public static function templateExtend($template)
{
array_push(self::$extend, $template);
array_push(self::$templateHeap, $template);
}

/**
Expand All @@ -47,22 +47,20 @@ public static function templateExtend($template)
*/
public static function render($template)
{
$text = self::requireIntoString($template);

while (!empty(self::$extend)) {
self::$content = $text;
$text = self::requireIntoString(array_pop(self::$extend));
$templateContent = self::requireIntoString($template);
while (!empty(self::$templateHeap)) {
self::$contentToRender = $templateContent;
$templateContent = self::requireIntoString(array_pop(self::$templateHeap));
}

return $text;
return $templateContent;
}

/**
* Used to print some content into layout.
*/
public static function content()
{
echo self::$content;
echo self::$contentToRender;
}

/**
Expand Down

0 comments on commit 9824aea

Please sign in to comment.