Skip to content

Instantly share code, notes, and snippets.

@mpociot
Created August 9, 2016 12:00
Show Gist options
  • Select an option

  • Save mpociot/c17cae18e1663efad2fd439ece26b92c to your computer and use it in GitHub Desktop.

Select an option

Save mpociot/c17cae18e1663efad2fd439ece26b92c to your computer and use it in GitHub Desktop.
<?php
namespace Mpociot\SlackBot;
class PizzaConversation extends Conversation
{
protected $size;
protected $topping;
public function askSize()
{
return $this->ask('What size do you want?', function($answer){
$this->size = $answer;
$this->reply('Okay - you get a '.$answer.' pizza.');
$this->askFlavor();
});
}
public function askFlavor()
{
return $this->ask('What topping do you want?', function($answer){
$this->reply('Okay - you get '.$answer.' on top of your '.$this->size.' pizza.');
});
}
public function run()
{
$this->askSize();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment