private function parse_exitTagContext() { $current = $this->current; if (isset($this->currentScalarProperty)) { $prop = $this->currentScalarProperty; $v = $this->currentScalarValue; $this->currentScalarProperty = null; $this->currentScalarValue = ''; if (Expression::isBindingExpression($v)) { $this->current->bind($prop, $v); } else { $this->current->props->{$prop} = $v; } } else { $this->text_optimize($current); $parent = $current->parent; $current->onParsingComplete(); //Note: calling this method may unset the 'parent' property (ex. with macros, which are immediately removed from the DOM). // Check if the metadata context is being closed. if (isset($this->metadataContainer) && $this->current === $this->metadataContainer) { $this->metadataContainer = null; } $this->current = $parent; //also discards the current scalar parameter, if that is the case. } }
function __construct($expression) { if (Expression::isCompositeBinding($expression)) { throw new DataBindingException("Multiple binding expressions on a string are not supported: <kbd>{$expression}</kbd>\n<p>Convert it to a single expression using the <kbd>+</kbd> string concatenation operator."); } if (!preg_match(self::$PARSE_BINDING_EXP, $expression, $matches)) { throw new DataBindingException("Invalid databinding expression: {$expression}"); } list($full, $this->expression) = $matches; }
/** * Evaluates the given binding expression on the component's context. * * <p>This method is an **extension hook** that allows a subclass to modify the evaluation result. * > <p>**Ex.** see the {@see Text} component. * * @param Expression $bindExp * @return mixed * @throws ComponentException * @throws DataBindingException */ protected function evalBinding(Expression $bindExp) { $binder = $this->getDataBinder(); if (!$binder) { _log()->warning("No binder is set for evaluating an expression on a " . $this->getTagName() . " component"); return null; } try { /** @var Component $this */ return $bindExp->evaluate($binder); } catch (\Exception $e) { self::evalError($e, $bindExp); } catch (\Error $e) { self::evalError($e, $bindExp); } }