private function getScenario(AfterStepScope $scope)
{
$scenarios = $scope->getFeature()->getScenarios();
foreach ($scenarios as $scenario) {
$stepLinesInScenario = array_map(function (StepNode $step) {
return $step->getLine();
}, $scenario->getSteps());
if (in_array($scope->getStep()->getLine(), $stepLinesInScenario)) {
return $scenario;
}
}
throw new \LogicException('Unable to find the scenario');
}