/** * Error-resilient getter for a component's computed property value. * * @param string $prop * @param Component $component * @param bool $error * @return mixed */ private static function getBindingValue($prop, Component $component, &$error) { $error = $l = false; try { $l = ob_get_level(); $v = $component->getComputedPropValue($prop); } catch (\Exception $e) { $error = true; while (ob_get_level() > $l) { ob_end_clean(); } return "<b style='color:red'>ERROR</b>"; } return $v; }
/** * Gets the value of the specified property, performing data binding if the property is bound. * * @param string $propName * @param mixed $default [optional] * @return mixed */ function getComputed($propName, $default = null) { $v = $this->component->getComputedPropValue($propName); return exists($v) ? $v : $default; }