Alterway\Component\Workflow\Workflow::next PHP Метод

next() публичный Метод

Moves the current token to the next node of the workflow.
public next ( Alterway\Component\Workflow\ContextInterface $context ) : Workflow
$context Alterway\Component\Workflow\ContextInterface
Результат Workflow
    public function next(ContextInterface $context)
    {
        if (null === $this->current) {
            throw new Exception\NotInitializedWorkflowException();
        }
        $transitions = $this->current->getOpenTransitions($context);
        if (0 === count($transitions)) {
            throw new Exception\NoOpenTransitionException();
        } elseif (1 < count($transitions)) {
            throw new Exception\MoreThanOneOpenTransitionException();
        }
        $transition = array_pop($transitions);
        $token = $transition->getDestination()->getName();
        $this->initialize($token);
        $this->eventDispatcher->dispatch($token, new Event($context, $token));
        return $this;
    }