Resolves services.
Copied from \Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseDefinition().
mixed $value: If a string, then it is either a plain string (for example a class name) or a reference to a service. If it's an array then it's a list of such strings.
string|\Symfony\Component\DependencyInjection\Reference Either the string unchanged or the Reference object.
protected function resolveServices($value) {
if (is_array($value)) {
$value = array_map(array(
$this,
'resolveServices',
), $value);
}
elseif (is_string($value) && 0 === strpos($value, '@')) {
if (0 === strpos($value, '@?')) {
$value = substr($value, 2);
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
}
else {
$value = substr($value, 1);
$invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
}
if ('=' === substr($value, -1)) {
$value = substr($value, 0, -1);
$strict = FALSE;
}
else {
$strict = TRUE;
}
$value = new Reference($value, $invalidBehavior, $strict);
}
return $value;
}