public function __call($operationName, array $arguments)
{
$updatedOperations = $this->operations;
$updatedOperations[] = ['name' => $operationName, 'arguments' => $arguments];
if ($this->operationResolver->isFinalOperation($operationName)) {
$operationsBackup = $this->operations;
$contextBackup = $this->context;
$this->operations = $updatedOperations;
$operationResult = $this->evaluateOperations();
$this->operations = $operationsBackup;
$this->context = $contextBackup;
return $operationResult;
} else {
// non-final operation
$flowQuery = new FlowQuery($this->context, $updatedOperations);
$flowQuery->setOperationResolver($this->operationResolver);
// Only needed for unit tests; hacky!
return $flowQuery;
}
}