class SSViewer_DataPresenter extends SSViewer_Scope (View source)

This extends SSViewer_Scope to mix in data on top of what the item provides. This can be "global" data that is scope-independant (like BaseURL), or type-specific data that is layered on top cross-cut like (like $FirstLast etc).

It's separate from SSViewer_Scope to keep that fairly complex code as clean as possible.

Constants

ITEM

ITEM_ITERATOR

ITEM_ITERATOR_TOTAL

POP_INDEX

UP_INDEX

CURRENT_INDEX

ITEM_OVERLAY

Properties

protected $item from  SSViewer_Scope
protected $itemIterator from  SSViewer_Scope
protected $itemIteratorTotal from  SSViewer_Scope
protected array|null $overlay

Overlay variables. Take precedence over anything from the current scope

protected array|null $underlay

Underlay variables. Concede precedence to overlay variables or anything from the current scope

Methods

public
__construct($item, $overlay = null, $underlay = null, $inheritedScope = null)

No description

public
getItem()

No description

public
locally()

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

public
resetLocalScope()

No description

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

No description

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

$Up and $Top need to restore the overlay from the parent and top-level scope respectively.

public
object
self()

Gets the current object and resets the scope.

public
pushScope()

Store the current overlay (as it doesn't directly apply to the new scope that's being pushed). We want to store the overlay against the next item "up" in the stack (hence upIndex), rather than the current item, because SSViewer_Scope::obj() has already been called and pushed the new item to the stack by this point

public
popScope()

Now that we're going to jump up an item in the item stack, we need to restore the overlay that was previously stored against the next item "up" in the stack from the current one

public
next()

No description

public
__call($name, $arguments)

No description

protected
array
getItemStack()

No description

protected
setItemStack(array $stack)

No description

protected
int|null
getUpIndex()

No description

protected
createCallableArray($extraArray, $interfaceToQuery, $variableMethod, $createObject = false)

No description

public
array
getInjectedValue(string $property, array $params, bool $cast = true)

Get the injected value

Details

__construct($item, $overlay = null, $underlay = null, $inheritedScope = null)

No description

Parameters

$item
$overlay
$underlay
$inheritedScope

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

Parameters

$name
$arguments
$forceReturnedObject
$cache
$cacheName

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

$Up and $Top need to restore the overlay from the parent and top-level scope respectively.

Parameters

$name
$arguments
$forceReturnedObject
$cache
$cacheName

object self()

Gets the current object and resets the scope.

Return Value

object

pushScope()

Store the current overlay (as it doesn't directly apply to the new scope that's being pushed). We want to store the overlay against the next item "up" in the stack (hence upIndex), rather than the current item, because SSViewer_Scope::obj() has already been called and pushed the new item to the stack by this point

popScope()

Now that we're going to jump up an item in the item stack, we need to restore the overlay that was previously stored against the next item "up" in the stack from the current one

next()

No description

__call($name, $arguments)

No description

Parameters

$name
$arguments

protected array getItemStack()

No description

Return Value

array

protected setItemStack(array $stack)

No description

Parameters

array $stack

protected int|null getUpIndex()

No description

Return Value

int|null

protected createCallableArray($extraArray, $interfaceToQuery, $variableMethod, $createObject = false)

No description

Parameters

$extraArray
$interfaceToQuery
$variableMethod
$createObject

array getInjectedValue(string $property, array $params, bool $cast = true)

Get the injected value

Parameters

string $property

Name of property

array $params
bool $cast

If true, an object is always returned even if not an object.

Return Value

array

Result array with the keys 'value' for raw value, or 'obj' if contained in an object

Exceptions

InvalidArgumentException