/** * {@inheritdoc} */ public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) { $call = new TransformationCall($definitionCall->getEnvironment(), $definitionCall->getCallee(), $this, array($argumentValue)); $result = $callCenter->makeCall($call); if ($result->hasException()) { throw $result->getException(); } return $result->getReturn(); }
/** * Transforms argument value using transformation and returns a new one. * * @param RegexGenerator $regexGenerator * @param CallCenter $callCenter * @param DefinitionCall $definitionCall * @param mixed $argumentValue * * @return mixed * * @throws Exception If transformation throws exception */ public function transformArgument(RegexGenerator $regexGenerator, CallCenter $callCenter, DefinitionCall $definitionCall, $argumentValue) { $regex = $regexGenerator->generateRegex($definitionCall->getEnvironment()->getSuite()->getName(), $this->pattern, $definitionCall->getFeature()->getLanguage()); $this->match($regex, $argumentValue, $arguments); $call = new TransformationCall($definitionCall->getEnvironment(), $definitionCall->getCallee(), $this, $arguments); $result = $callCenter->makeCall($call); if ($result->hasException()) { throw $result->getException(); } return $result->getReturn(); }
/** * Executes transformation. * * @param DefinitionCall $definitionCall * @param Transformation $transformation * @param array $arguments * * @return mixed * * @throws Exception If transformation call throws one */ private function execute(DefinitionCall $definitionCall, Transformation $transformation, array $arguments) { $call = new TransformationCall($definitionCall->getEnvironment(), $definitionCall->getCallee(), $transformation, $arguments); $result = $this->callCenter->makeCall($call); if ($result->hasException()) { throw $result->getException(); } return $result->getReturn(); }
/** * Tests found definition. * * @param Environment $env * @param FeatureNode $feature * @param StepNode $step * @param SearchResult $search * @param Boolean $skip * * @return StepResult */ private function testDefinition(Environment $env, FeatureNode $feature, StepNode $step, SearchResult $search, $skip) { if (!$search->hasMatch()) { return new UndefinedStepResult(); } if ($skip) { return new SkippedStepResult($search); } $call = $this->createDefinitionCall($env, $feature, $search, $step); $result = $this->callCenter->makeCall($call); return new ExecutedStepResult($search, $result); }
/** * Dispatches single event hook. * * @param HookScope $scope * @param Hook $hook * * @return CallResult */ private function dispatchHook(HookScope $scope, Hook $hook) { return $this->callCenter->makeCall(new HookCall($scope, $hook)); }