|
| __construct ($context=null) |
| Mustache rendering Context constructor.
|
|
| find ($id) |
| Find a variable in the Context stack.
|
|
| findAnchoredDot ($id) |
| Find an 'anchored dot notation' variable in the Context stack.
|
|
| findDot ($id) |
| Find a 'dot notation' variable in the Context stack.
|
|
| findInBlock ($id) |
| Find an argument in the block context stack.
|
|
| last () |
| Get the last Context frame.
|
|
| pop () |
| Pop the last Context frame from the stack.
|
|
| popBlockContext () |
| Pop the last block Context frame from the stack.
|
|
| push ($value) |
| Push a new Context frame onto the stack.
|
|
| pushBlockContext ($value) |
| Push a new Context frame onto the block context stack.
|
|
◆ __construct()
Mustache_Context::__construct |
( |
| $context = null | ) |
|
Mustache rendering Context constructor.
- Parameters
-
mixed | $context | Default rendering context (default: null) |
◆ find()
Mustache_Context::find |
( |
| $id | ) |
|
Find a variable in the Context stack.
Starting with the last Context frame (the context of the innermost section), and working back to the top-level rendering context, look for a variable with the given name:
- If the Context frame is an associative array which contains the key $id, returns the value of that element.
- If the Context frame is an object, this will check first for a public method, then a public property named $id. Failing both of these, it will try
__isset
and __get
magic methods.
- If a value named $id is not found in any Context frame, returns an empty string.
- Parameters
-
- Return values
-
mixed | Variable value, or '' if not found |
◆ findAnchoredDot()
Mustache_Context::findAnchoredDot |
( |
| $id | ) |
|
Find an 'anchored dot notation' variable in the Context stack.
This is the same as findDot(), except it looks in the top of the context stack for the first value, rather than searching the whole context stack and starting from there.
- See also
- Mustache_Context\findDot
- Exceptions
-
- Parameters
-
string | $id | Dotted variable selector |
- Return values
-
mixed | Variable value, or '' if not found |
◆ findDot()
Mustache_Context::findDot |
( |
| $id | ) |
|
Find a 'dot notation' variable in the Context stack.
Note that dot notation traversal bubbles through scope differently than the regular find method. After finding the initial chunk of the dotted name, each subsequent chunk is searched for only within the value of the previous result. For example, given the following context stack:
$data = array(
'name' => 'Fred',
'child' => array(
'name' => 'Bob'
),
);
... and the Mustache following template:
{{ child.name }}
... the name
value is only searched for within the child
value of the global Context, not within parent Context frames.
- Parameters
-
string | $id | Dotted variable selector |
- Return values
-
mixed | Variable value, or '' if not found |
◆ findInBlock()
Mustache_Context::findInBlock |
( |
| $id | ) |
|
Find an argument in the block context stack.
- Parameters
-
- Return values
-
mixed | Variable value, or '' if not found |
◆ last()
Mustache_Context::last |
( |
| ) |
|
Get the last Context frame.
- Return values
-
mixed | Last Context frame (object or array) |
◆ pop()
Mustache_Context::pop |
( |
| ) |
|
Pop the last Context frame from the stack.
- Return values
-
mixed | Last Context frame (object or array) |
◆ popBlockContext()
Mustache_Context::popBlockContext |
( |
| ) |
|
Pop the last block Context frame from the stack.
- Return values
-
mixed | Last block Context frame (object or array) |
◆ push()
Mustache_Context::push |
( |
| $value | ) |
|
Push a new Context frame onto the stack.
- Parameters
-
mixed | $value | Object or array to use for context |
◆ pushBlockContext()
Mustache_Context::pushBlockContext |
( |
| $value | ) |
|
Push a new Context frame onto the block context stack.
- Parameters
-
mixed | $value | Object or array to use for block context |
The documentation for this class was generated from the following file:
- lib/mustache/src/Mustache/Context.php