public function evaluate(FlowQuery $flowQuery, array $arguments)
{
$context = $flowQuery->getContext();
if ($context instanceof \Iterator) {
$context = iterator_to_array($context);
}
if (isset($arguments[0]) && isset($arguments[1])) {
$context = array_slice($context, (int) $arguments[0], (int) $arguments[1] - (int) $arguments[0]);
} elseif (isset($arguments[0])) {
$context = array_slice($context, (int) $arguments[0]);
}
$flowQuery->setContext($context);
}
/** * @test * @dataProvider sliceExamples */ public function evaluateSetsTheCorrectPartOfTheContextArray($value, $arguments, $expected) { $flowQuery = new \Neos\Eel\FlowQuery\FlowQuery($value); $operation = new SliceOperation(); $operation->evaluate($flowQuery, $arguments); $this->assertEquals($expected, $flowQuery->getContext()); }