Skip to content
Snippets Groups Projects
Commit 519d3783 authored by Peter Rotich's avatar Peter Rotich
Browse files

Make variable replacer aware of castable objects

Long term 'asVar' will be replaced with __toString function
parent 231a2fa2
No related branches found
No related tags found
No related merge requests found
......@@ -63,8 +63,12 @@ class VariableReplacer {
if(!$obj) return "";
if (!$var && method_exists($obj, 'asVar')) //XXX: to_string?
return call_user_func(array($obj, 'asVar'));
if (!$var) {
if (method_exists($obj, 'asVar'))
return call_user_func(array($obj, 'asVar'));
elseif (method_exists($obj, '__toString'))
return (string) $obj;
}
list($v, $part) = explode('.', $var, 2);
if ($v && is_callable(array($obj, 'get'.ucfirst($v)))) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment