public function __construct($namespace, $elem, $parent) { if (array_key_exists('value', $elem[ZXml::TAG_ATTRIBUTES_KEY])) { $this->valueBind = ZExpression::unpackExpression($elem[ZXml::TAG_ATTRIBUTES_KEY]['value']); } parent::__construct($namespace, $elem, $parent); }
public static function parse($expr, $context = null) { $expr = trim($expr); if (empty($expr) || !is_string($expr)) { return false; } preg_match(self::METHOD_EXPRESSION_PATTERN, $expr, $matches); if (empty($matches)) { return false; } $object = $matches[1]; $method = $matches[2]; $paramString = trim($matches[3]); $str = strlen($paramString); if (strlen($str) > 0) { $params = ZExpression::parseList($paramString, $context, true); } else { $params = array(); } return new ZMethodExpression($object, $method, $params, $context); }
protected function evaluateZX($oldvalue) { $value = $oldvalue; if (($expr = ZExpression::parse($value, $this)) !== false) { try { $value = $expr->getValue(); // its just a nested ZX if ($oldvalue != $expr->fullExpression) { $value = str_replace($expr->fullExpression, $value, $oldvalue); } } catch (ZExpressionException $e) { throw new ZException("Failed to evaluate ZX in {$this->fullName}. ZX: {$expr->expression}", 201, $e); } } return $value; }