Alterway\Component\Workflow\Workflow::initialize PHP Method

initialize() public method

Initializes the workflow with a given token.
public initialize ( string $token = null ) : Workflow
$token string
return Workflow
    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;
    }