protected function parseConfigurationArray($objectName, array $rawConfigurationOptions, $configurationSourceHint = '', $existingObjectConfiguration = null)
{
$className = isset($rawConfigurationOptions['className']) ? $rawConfigurationOptions['className'] : $objectName;
$objectConfiguration = $existingObjectConfiguration instanceof Configuration ? $existingObjectConfiguration : new Configuration($objectName, $className);
$objectConfiguration->setConfigurationSourceHint($configurationSourceHint);
foreach ($rawConfigurationOptions as $optionName => $optionValue) {
switch ($optionName) {
case 'scope':
$objectConfiguration->setScope($this->parseScope($optionValue));
break;
case 'properties':
if (is_array($optionValue)) {
foreach ($optionValue as $propertyName => $propertyValue) {
if (array_key_exists('value', $propertyValue)) {
$property = new ConfigurationProperty($propertyName, $propertyValue['value'], ConfigurationProperty::PROPERTY_TYPES_STRAIGHTVALUE);
} elseif (array_key_exists('object', $propertyValue)) {
$property = $this->parsePropertyOfTypeObject($propertyName, $propertyValue['object'], $objectConfiguration);
} elseif (array_key_exists('setting', $propertyValue)) {
$property = new ConfigurationProperty($propertyName, ['type' => ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'path' => $propertyValue['setting']], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
} else {
throw new InvalidObjectConfigurationException('Invalid configuration syntax. Expecting "value", "object" or "setting" as value for property "' . $propertyName . '", instead found "' . (is_array($propertyValue) ? implode(', ', array_keys($propertyValue)) : $propertyValue) . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1230563249);
}
$objectConfiguration->setProperty($property);
}
}
break;
case 'arguments':
if (is_array($optionValue)) {
foreach ($optionValue as $argumentName => $argumentValue) {
if (array_key_exists('value', $argumentValue)) {
$argument = new ConfigurationArgument($argumentName, $argumentValue['value'], ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
} elseif (array_key_exists('object', $argumentValue)) {
$argument = $this->parseArgumentOfTypeObject($argumentName, $argumentValue['object'], $configurationSourceHint);
} elseif (array_key_exists('setting', $argumentValue)) {
$argument = new ConfigurationArgument($argumentName, $argumentValue['setting'], ConfigurationArgument::ARGUMENT_TYPES_SETTING);
} else {
throw new InvalidObjectConfigurationException('Invalid configuration syntax. Expecting "value", "object" or "setting" as value for argument "' . $argumentName . '", instead found "' . (is_array($argumentValue) ? implode(', ', array_keys($argumentValue)) : $argumentValue) . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1230563250);
}
$objectConfiguration->setArgument($argument);
}
}
break;
case 'className':
case 'factoryObjectName':
case 'factoryMethodName':
case 'lifecycleInitializationMethodName':
case 'lifecycleShutdownMethodName':
$methodName = 'set' . ucfirst($optionName);
$objectConfiguration->{$methodName}(trim($optionValue));
break;
case 'autowiring':
$objectConfiguration->setAutowiring($this->parseAutowiring($optionValue));
break;
default:
throw new InvalidObjectConfigurationException('Invalid configuration option "' . $optionName . '" (source: ' . $objectConfiguration->getConfigurationSourceHint() . ')', 1167574981);
}
}
return $objectConfiguration;
}