protected function getProcessedValue($unparsedValue)
{
if (preg_match(self::SPLIT_PATTERN_VALUENUMBER, $unparsedValue, $matches) === 1) {
$processedValue = intval($unparsedValue);
} elseif (preg_match(self::SPLIT_PATTERN_VALUEFLOATNUMBER, $unparsedValue, $matches) === 1) {
$processedValue = floatval($unparsedValue);
} elseif (preg_match(Package::EelExpressionRecognizer, $unparsedValue, $matches) === 1) {
// Single-line Eel Expressions
$processedValue = array('__eelExpression' => $matches[1], '__value' => null, '__objectType' => null);
} elseif (preg_match(self::SPLIT_PATTERN_VALUELITERAL, $unparsedValue, $matches) === 1) {
$processedValue = stripslashes(isset($matches[2]) ? $matches[2] : $matches[1]);
} elseif (preg_match(self::SPLIT_PATTERN_VALUEMULTILINELITERAL, $unparsedValue, $matches) === 1) {
$processedValue = stripslashes(isset($matches['SingleQuoteValue']) ? $matches['SingleQuoteValue'] : $matches['DoubleQuoteValue']);
$closingQuoteChar = isset($matches['SingleQuoteChar']) ? $matches['SingleQuoteChar'] : $matches['DoubleQuoteChar'];
$regexp = '/(?P<Value>(?:\\\\.|[^\\\\' . $closingQuoteChar . '])*)(?P<QuoteChar>' . $closingQuoteChar . '?)/';
while (($typoScriptLine = $this->getNextTypoScriptLine()) !== false) {
preg_match($regexp, $typoScriptLine, $matches);
$processedValue .= "\n" . stripslashes($matches['Value']);
if (!empty($matches['QuoteChar'])) {
break;
}
}
} elseif (preg_match(self::SPLIT_PATTERN_VALUEBOOLEAN, $unparsedValue, $matches) === 1) {
$processedValue = strtolower($matches[1]) === 'true';
} elseif (preg_match(self::SPLIT_PATTERN_VALUENULL, $unparsedValue, $matches) === 1) {
$processedValue = null;
} elseif (preg_match(self::SCAN_PATTERN_VALUEOBJECTTYPE, $unparsedValue, $matches) === 1) {
if (empty($matches['namespace'])) {
$objectTypeNamespace = $this->objectTypeNamespaces['default'];
} else {
$objectTypeNamespace = isset($this->objectTypeNamespaces[$matches['namespace']]) ? $this->objectTypeNamespaces[$matches['namespace']] : $matches['namespace'];
}
$processedValue = array('__objectType' => $objectTypeNamespace . ':' . $matches['unqualifiedType'], '__value' => null, '__eelExpression' => null);
} else {
// Trying to match multiline Eel expressions
if (strpos($unparsedValue, '${') === 0) {
$eelExpressionSoFar = $unparsedValue;
// potential start of multiline Eel Expression; trying to consume next lines...
while (($line = $this->getNextTypoScriptLine()) !== false) {
$eelExpressionSoFar .= chr(10) . $line;
if (substr($line, -1) === '}') {
// potential end-of-eel-expression marker
$matches = array();
if (preg_match(Package::EelExpressionRecognizer, $eelExpressionSoFar, $matches) === 1) {
// Single-line Eel Expressions
$processedValue = array('__eelExpression' => str_replace(chr(10), '', $matches[1]), '__value' => null, '__objectType' => null);
break;
}
}
}
if ($line === false) {
// if the last line we consumed is FALSE, we have consumed the end of the file.
throw new Fusion\Exception('Syntax error: A multi-line Eel expression starting with "' . $unparsedValue . '" was not closed.', 1417616064);
}
} else {
throw new Fusion\Exception('Syntax error: Invalid value "' . $unparsedValue . '" in value assignment.', 1180604192);
}
}
return $processedValue;
}