Twig_Template::getAttribute
Returns the attribute value for a given array/object.
Signature
protected function getAttribute(mixed
$object,
[mixed
$item = Twig_TemplateInterface::ANY_CALL,
[array
$arguments = Twig_TemplateInterface::ANY_CALL,
[string
$type = Twig_TemplateInterface::ANY_CALL,
[Boolean
$isDefinedTest = false,
[Boolean
$ignoreStrictCheck = false]]]]] )
Parameters
$object
—
mixed
- The object or array from where to get the item
$item
—
mixed
- The item to get from the array or object
$arguments
—
array
- An array of arguments to pass if the item is an object method
$type
—
string
- The type of attribute (@see Twig_TemplateInterface)
$isDefinedTest
—
object
- Whether this is only a defined check
$ignoreStrictCheck
—
object
- Whether to ignore the strict attribute check or not
Returns
- mixed
- The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
Errors/Exceptions
-
Twig_Error_Runtime
- if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false