public propertyValue ( &$value, [type] $keyName = null ) : boolean | ||
$keyName | [type] | |
return | boolean |
public function propertyValue(&$value, $keyName = null)
{
$values = array();
if ($keyName !== null) {
$this->env->currentProperty = $keyName;
}
$s = null;
while ($this->expressionList($v)) {
$values[] = $v;
$s = $this->seek();
if (!$this->literal(',')) {
break;
}
}
if ($s) {
$this->seek($s);
}
if ($keyName !== null) {
unset($this->env->currentProperty);
}
if (count($values) == 0) {
return false;
}
$value = Less::compressList($values, ', ');
return true;
}
/** * Inject array of unparsed strings into environment as variables * * @param type $args X * * @return void * * @throws \Exception */ protected function injectVariables($args) { $this->pushEnv(); /** FOF -- BEGIN CHANGE * */ $parser = new Parser($this, __METHOD__); /** FIF -- END CHANGE * */ foreach ($args as $name => $strValue) { if ($name[0] != '@') { $name = '@' . $name; } $parser->count = 0; $parser->buffer = (string) $strValue; if (!$parser->propertyValue($value)) { throw new \Exception("failed to parse passed in variable {$name}: {$strValue}"); } $this->set($name, $value); } }