Processes arguments to determine invalid references.
array $arguments An array of Reference objects:
Boolean $inMethodCall:
array
RuntimeException When the config is invalid
private function processArguments(array $arguments, $inMethodCall = false) {
foreach ($arguments as $k => $argument) {
if (is_array($argument)) {
$arguments[$k] = $this
->processArguments($argument, $inMethodCall);
}
elseif ($argument instanceof Reference) {
$id = (string) $argument;
$invalidBehavior = $argument
->getInvalidBehavior();
$exists = $this->container
->has($id);
// resolve invalid behavior
if (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
$arguments[$k] = null;
}
elseif (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {
if ($inMethodCall) {
throw new RuntimeException('Method shouldn\'t be called.');
}
$arguments[$k] = null;
}
}
}
return $arguments;
}