/**
* Visualizes the current state of the workflow execution.
*
* @param ezcWorkflowExecution $execution
*/
protected function visualize(ezcWorkflowExecution $execution)
{
$activatedNodes = array();
foreach ($execution->getActivatedNodes() as $node) {
$activatedNodes[] = $node->getId();
}
if ($this->options['includeVariables']) {
$variables = $execution->getVariables();
} else {
$variables = array();
}
$visitor = new ezcWorkflowVisitorVisualization();
$visitor->options['highlightedNodes'] = $activatedNodes;
$visitor->options['workflowVariables'] = $variables;
$execution->workflow->accept($visitor);
file_put_contents(sprintf('%s%s%s_%03d_%03d.dot', $this->options['directory'], DIRECTORY_SEPARATOR, $execution->workflow->name, $execution->getId(), ++$this->fileCounter), $visitor);
}