public function __construct(ProcessModel $model, Node $startNode = NULL, array $variables = []) { $this->model = $model; $this->variables = $variables; if ($startNode === NULL) { $initial = $model->findInitialNodes(); if (count($initial) != 1) { throw new \RuntimeException(sprintf('Process "%s" does not declare exactly 1 start node', $model->getTitle())); } $this->startNode = array_shift($initial); } else { $this->startNode = $startNode; } }