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

Cancel the current conversation
public cancel ( ) : boolean
Результат boolean
Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $text = 'No active conversation!';
     //Cancel current conversation if any
     $conversation = new Conversation($this->getMessage()->getFrom()->getId(), $this->getMessage()->getChat()->getId());
     if ($conversation_command = $conversation->getCommand()) {
         $conversation->cancel();
         $text = 'Conversation "' . $conversation_command . '" cancelled!';
     }
     return $this->hideKeyboard($text);
 }
 /**
  * @test
  */
 public function cancelConversation()
 {
     $info = TestHelpers::startFakeConversation('command');
     $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command');
     $this->assertTrue($conversation->exists());
     $conversation->cancel();
     $conversation2 = new Conversation($info['user_id'], $info['chat_id']);
     $this->assertFalse($conversation2->exists());
 }