46 $this->variables = $variableArray;
58 public function add($identifier, $value) {
59 if (array_key_exists($identifier, $this->variables)) {
60 throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException(
'Duplicate variable declaration, "' . $identifier .
'" already set!', 1224479063);
62 if (in_array(strtolower($identifier), self::$reservedVariableNames)) {
63 throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException(
'"' . $identifier .
'" is a reserved variable name and cannot be used as variable identifier.', 1256730379);
65 $this->variables[$identifier] = $value;
78 public function get($identifier) {
79 if ($identifier ===
'_all') {
82 if (!array_key_exists($identifier, $this->variables)) {
83 throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException(
'Tried to get a variable "' . $identifier .
'" which is not stored in the context!', 1224479370);
85 return $this->variables[$identifier];
96 public function remove($identifier) {
97 if (!array_key_exists($identifier, $this->variables)) {
98 throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException(
'Tried to remove a variable "' . $identifier .
'" which is not stored in the context!', 1224479372);
100 unset($this->variables[$identifier]);
109 return array_keys($this->variables);
129 if ($identifier ===
'_all') {
133 return array_key_exists($identifier, $this->variables);
142 return array(
'variables');
153 $this->
add($identifier, $value);
163 $this->
remove($identifier);
173 return $this->
exists($identifier);
183 return $this->
get($identifier);
__construct(array $variableArray=array())
static $reservedVariableNames
offsetExists($identifier)
offsetSet($identifier, $value)