getValue() public method

public getValue ( ) : mixed
return mixed
コード例 #1
0
ファイル: ParameterBag.php プロジェクト: nelmio/alice
 /**
  * Returns a new instance which will include the passed parameter. If a parameter with that key already exist, it
  * WILL NOT be overridden.
  *
  * @param Parameter $parameter
  *
  * @return self
  */
 public function with(Parameter $parameter) : self
 {
     $key = $parameter->getKey();
     $clone = clone $this;
     if (false === $clone->has($key)) {
         $clone->parameters[$key] = $parameter->getValue();
     }
     return $clone;
 }
コード例 #2
0
 /**
  * @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;
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function canResolve(Parameter $parameter) : bool
 {
     return is_string($parameter->getValue());
 }
コード例 #4
0
 /**
  * @inheritdoc
  */
 public function canResolve(Parameter $parameter) : bool
 {
     $value = $parameter->getValue();
     return null === $value || is_bool($value) || is_numeric($value) || is_object($value);
 }