has() public method

public has ( string $key ) : boolean
$key string
return boolean
 /**
  * @inheritdoc
  */
 public function resolve(ParameterBag $unresolvedParameters, ParameterBag $injectedParameters = null) : ParameterBag
 {
     if (null === $injectedParameters) {
         $injectedParameters = new ParameterBag();
     }
     foreach ($injectedParameters as $injectedParameterKey => $injectedParameterValue) {
         if ($unresolvedParameters->has($injectedParameterKey)) {
             $injectedParameters = $injectedParameters->without($injectedParameterKey);
         }
     }
     return $this->resolver->resolve($unresolvedParameters, $injectedParameters);
 }
Ejemplo n.º 2
0
 /**
  * @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);
 }