/** * Initializes the workflow with a given token. * * @param string $token * * @return Workflow * * @throws Exception\InvalidTokenException */ public function initialize($token = null) { if (null === $token) { $this->current = $this->start; } elseif ($this->nodes->has($token)) { $this->current = $this->nodes->get($token); } else { throw new Exception\InvalidTokenException(); } return $this; }