/**
  * @inheritdoc
  */
 public function resolve(ParameterBag $unresolvedParameters, ParameterBag $injectedParameters = null) : ParameterBag
 {
     $resolvedParameters = null === $injectedParameters ? new ParameterBag() : $injectedParameters;
     foreach ($unresolvedParameters as $key => $value) {
         if ($resolvedParameters->has($key)) {
             continue;
         }
         $context = new ResolvingContext($key);
         $resolvedParameters = $this->resolver->resolve(new Parameter($key, $value), $unresolvedParameters, $resolvedParameters, $context);
     }
     return $resolvedParameters;
 }
 /**
  * @inheritdoc
  */
 public function resolve(Parameter $unresolvedArrayParameter, ParameterBag $unresolvedParameters, ParameterBag $resolvedParameters, ResolvingContext $context = null) : ParameterBag
 {
     if (null === $this->resolver) {
         throw ResolverNotFoundExceptionFactory::createUnexpectedCall(__METHOD__);
     }
     $context = ResolvingContext::createFrom($context, $unresolvedArrayParameter->getKey());
     $resolvedArray = [];
     /* @var array $unresolvedArray */
     $unresolvedArray = $unresolvedArrayParameter->getValue();
     foreach ($unresolvedArray as $index => $unresolvedValue) {
         // Iterate over all the values of the array to resolve each of them
         $resolvedParameters = $this->resolver->resolve(new Parameter((string) $index, $unresolvedValue), $unresolvedParameters, $resolvedParameters, $context);
         $resolvedArray[$index] = $resolvedParameters->get((string) $index);
         $resolvedParameters = $resolvedParameters->without((string) $index);
     }
     $resolvedParameters = $resolvedParameters->with($unresolvedArrayParameter->withValue($resolvedArray));
     return $resolvedParameters;
 }
 /**
  * @param ParameterResolverInterface $resolver
  * @param Parameter                  $parameter Parameter being resolved
  * @param string                     $key       Key of the parameter that need to be resolved to resolve $parameter
  * @param ParameterBag               $unresolvedParameters
  * @param ParameterBag               $resolvedParameters
  * @param ResolvingContext           $context
  *
  * @return ParameterBag
  */
 private function resolveStringKey(ParameterResolverInterface $resolver = null, Parameter $parameter, string $key, ParameterBag $unresolvedParameters, ParameterBag $resolvedParameters, ResolvingContext $context) : ParameterBag
 {
     if ($resolvedParameters->has($key)) {
         return $resolvedParameters;
     }
     if (false === $unresolvedParameters->has($key)) {
         throw ParameterNotFoundExceptionFactory::createForWhenResolvingParameter($key, $parameter);
     }
     $context->checkForCircularReference($key);
     $context->add($key);
     if (null === $resolver) {
         throw ResolverNotFoundExceptionFactory::createUnexpectedCall(__METHOD__);
     }
     return $resolver->resolve(new Parameter($key, $unresolvedParameters->get($key)), $unresolvedParameters, $resolvedParameters, $context);
 }