public function __call($name, $arguments) { //extract the method name and parameters $property = $arguments[0]; //the name of the public function being called //the public function parameters in an array if (isset($arguments[1]) && $arguments[1] != null) { $params = $arguments[1]; } else { $params = array(); } $val = $this->getInjectedValue($property, $params); if ($val) { $obj = $val['obj']; if ($name === 'hasValue') { $res = $obj instanceof Object ? $obj->exists() : (bool) $obj; } else { // XML_val $res = $obj->forTemplate(); } $this->resetLocalScope(); return $res; } else { return parent::__call($name, $arguments); } }
public function __call($name, $arguments) { //extract the method name and parameters $property = $arguments[0]; //the name of the public function being called //the public function parameters in an array if (isset($arguments[1]) && $arguments[1] != null) { $params = $arguments[1]; } else { $params = array(); } $hasInjected = $res = null; if ($name == 'hasValue') { if ($val = $this->getInjectedValue($property, $params, false)) { $hasInjected = true; $res = (bool) $val['value']; } } else { // XML_val if ($val = $this->getInjectedValue($property, $params)) { $hasInjected = true; $obj = $val['obj']; $res = $obj->forTemplate(); } } if ($hasInjected) { $this->resetLocalScope(); return $res; } else { return parent::__call($name, $arguments); } }
function __call($name, $arguments) { $property = $arguments[0]; if ($this->extras && array_key_exists($property, $this->extras)) { $this->resetLocalScope(); $value = $this->extras[$arguments[0]]; switch ($name) { case 'hasValue': return (bool) $value; default: return $value; } } return parent::__call($name, $arguments); }