CustomVariables: add render support

This commit is contained in:
Thomas Gelf 2015-06-11 19:23:18 +02:00
parent 57d443157f
commit 93ead1f68e
1 changed files with 24 additions and 1 deletions

View File

@ -22,6 +22,7 @@ class CustomVariables
{
$key = (string) $key;
// TODO: add support for null values
if ($value === null) {
unset($this->$key);
}
@ -48,6 +49,17 @@ class CustomVariables
return $this;
}
public function toConfigString()
{
$out = '';
foreach ($this->vars as $key => $var) {
$out .= $var->toConfigString()
}
return $out;
}
public function __get($key)
{
return $this->get($key);
@ -89,5 +101,16 @@ class CustomVariables
$this->properties[$key] = $this->defaultProperties[$key];
}
public function __toString()
{
try {
return $this->toConfigString();
} catch (Exception $e) {
trigger_error($e);
$previousHandler = set_exception_handler(function () {});
restore_error_handler();
call_user_func($previousHandler, $e);
die();
}
}
}