Whoops. Missed some docs and cleanup :)

This commit is contained in:
Justin Hileman
2014-06-27 00:18:41 -07:00
parent 349b58b8ca
commit 1fe5b0dfc2
2 changed files with 27 additions and 9 deletions
+1
View File
@@ -334,6 +334,7 @@ class Mustache_Compiler
* @param string $otag Current Mustache opening tag * @param string $otag Current Mustache opening tag
* @param string $ctag Current Mustache closing tag * @param string $ctag Current Mustache closing tag
* @param int $level * @param int $level
* @param bool $arg (default: false)
* *
* @return string Generated section PHP source code * @return string Generated section PHP source code
*/ */
+21 -4
View File
@@ -15,7 +15,7 @@
class Mustache_Context class Mustache_Context
{ {
private $stack = array(); private $stack = array();
private $block_stack = array(); private $blockStack = array();
/** /**
* Mustache rendering Context constructor. * Mustache rendering Context constructor.
@@ -39,9 +39,14 @@ class Mustache_Context
array_push($this->stack, $value); array_push($this->stack, $value);
} }
/**
* Push a new Context frame onto the block context stack.
*
* @param mixed $value Object or array to use for block context
*/
public function pushBlockContext($value) public function pushBlockContext($value)
{ {
array_push($this->block_stack, $value); array_push($this->blockStack, $value);
} }
/** /**
@@ -54,9 +59,14 @@ class Mustache_Context
return array_pop($this->stack); return array_pop($this->stack);
} }
/**
* Pop the last block Context frame from the stack.
*
* @return mixed Last block Context frame (object or array)
*/
public function popBlockContext() public function popBlockContext()
{ {
return array_pop($this->block_stack); return array_pop($this->blockStack);
} }
/** /**
@@ -131,9 +141,16 @@ class Mustache_Context
return $value; return $value;
} }
/**
* Find an argument in the block context stack.
*
* @param string $id
*
* @return mixed Variable value, or '' if not found.
*/
public function findInBlock($id) public function findInBlock($id)
{ {
foreach ($this->block_stack as $context) { foreach ($this->blockStack as $context) {
if (array_key_exists($id, $context)) { if (array_key_exists($id, $context)) {
return $context[$id]; return $context[$id];
} }