/**
  * @inheritdoc
  */
 public function applyToken($name, Request $request)
 {
     if (!isset($this->tokens[$name])) {
         throw new \Exception(sprintf('Cannot flow by %s, because token of this name doesn\'t exits', $name));
     }
     $token = $this->tokens[$name];
     $response = $this->coordinator->consume($token, $request);
     if ($token->isConsumed()) {
         $state = $token->getTargetState();
         $this->updateObject($state);
         $this->updateMachine($this->object);
     }
     return $response;
 }
 /**
  * @inheritdoc
  */
 public function consume(TokenInterface $token, Request $request)
 {
     return $this->coordinator->consume($token, $request);
 }