class SSViewer_Scope

This tracks the current scope for an SSViewer instance. It has three goals: - Handle entering & leaving sub-scopes in loops and withs - Track Up and Top - (As a side effect) Inject data that needs to be available globally (used to live in ViewableData)

In order to handle up, rather than tracking it using a tree, which would involve constructing new objects for each step, we use indexes into the itemStack (which already has to exist).

Each item has three indexes associated with it

  • Pop. Which item should become the scope once the current scope is popped out of
  • Up. Which item is up from this item
  • Current. Which item is the first time this object has appeared in the stack

We also keep the index of the current starting point for lookups. A lookup is a sequence of obj calls - when in a loop or with tag the end result becomes the new scope, but for injections, we throw away the lookup and revert back to the original scope once we've got the value we're after

Constants

ITEM

ITEM_ITERATOR

ITEM_ITERATOR_TOTAL

POP_INDEX

UP_INDEX

CURRENT_INDEX

ITEM_OVERLAY

Methods

__construct($item, $inheritedScope = null)

No description

getItem()

No description

locally()

Called at the start of every lookup chain by SSTemplateParser to indicate a new lookup from local scope

resetLocalScope()

No description

getObj($name, $arguments = null, $forceReturnedObject = true, $cache = false, $cacheName = null)

No description

obj($name, $arguments = null, $forceReturnedObject = true, $cache = false, $cacheName = null)

No description

object
self()

Gets the current object and resets the scope.

pushScope()

No description

popScope()

No description

next()

No description

__call($name, $arguments)

No description

Details

at line 59
__construct($item, $inheritedScope = null)

Parameters

$item
$inheritedScope

at line 72
getItem()

at line 77
locally()

Called at the start of every lookup chain by SSTemplateParser to indicate a new lookup from local scope

at line 88
resetLocalScope()

at line 97
getObj($name, $arguments = null, $forceReturnedObject = true, $cache = false, $cacheName = null)

Parameters

$name
$arguments
$forceReturnedObject
$cache
$cacheName

at line 102
obj($name, $arguments = null, $forceReturnedObject = true, $cache = false, $cacheName = null)

Parameters

$name
$arguments
$forceReturnedObject
$cache
$cacheName

at line 136
object self()

Gets the current object and resets the scope.

Return Value

object

at line 143
pushScope()

at line 156
popScope()

at line 163
next()

at line 185
__call($name, $arguments)

Parameters

$name
$arguments