/** * {@inheritdoc} * * @param FunctionCallValue $value */ public function resolve(ValueInterface $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context) : ResolvedValueWithFixtureSet { $functionName = $value->getName(); if (false === function_exists($functionName) || array_key_exists($functionName, $this->functionBlacklist)) { return $this->resolver->resolve($value, $fixture, $fixtureSet, $scope, $context); } $arguments = $value->getArguments(); return new ResolvedValueWithFixtureSet($functionName(...$arguments), $fixtureSet); }
/** * {@inheritdoc} * * @param FunctionCallValue $value */ public function resolve(ValueInterface $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context) : ResolvedValueWithFixtureSet { /** * @var FakerGenerator $generator * @var string $formatter */ list($generator, $formatter) = $this->getGenerator($this->generatorFactory, $value->getName()); return new ResolvedValueWithFixtureSet($generator->format($formatter, $value->getArguments()), $fixtureSet); }
/** * {@inheritdoc} * * @param FunctionCallValue $value */ public function resolve(ValueInterface $value, FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, array $scope, GenerationContext $context) : ResolvedValueWithFixtureSet { if (null === $this->argumentResolver) { throw ResolverNotFoundExceptionFactory::createUnexpectedCall(__METHOD__); } $arguments = $value->getArguments(); foreach ($arguments as $index => $argument) { if ($argument instanceof ValueInterface) { $resolvedSet = $this->argumentResolver->resolve($argument, $fixture, $fixtureSet, $scope, $context); $arguments[$index] = $resolvedSet->getValue(); $fixtureSet = $resolvedSet->getSet(); } } return $this->resolver->resolve(new FunctionCallValue($value->getName(), $arguments), $fixture, $fixtureSet, $scope, $context); }