| @@ 11-32 (lines=22) @@ | ||
| 8 | use FondBot\Conversation\ConversationCreator; |
|
| 9 | use Symfony\Component\Console\Input\InputArgument; |
|
| 10 | ||
| 11 | class MakeIntent extends Command |
|
| 12 | { |
|
| 13 | protected function configure(): void |
|
| 14 | { |
|
| 15 | $this |
|
| 16 | ->setName('make:intent') |
|
| 17 | ->setDescription('Create a new intent class') |
|
| 18 | ->addArgument('name', InputArgument::REQUIRED, 'Name of intent'); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function handle(): void |
|
| 22 | { |
|
| 23 | $name = $this->getArgument('name'); |
|
| 24 | ||
| 25 | /** @var ConversationCreator $creator */ |
|
| 26 | $creator = $this->kernel->resolve(ConversationCreator::class); |
|
| 27 | ||
| 28 | $creator->createIntent('src', 'App', $name); |
|
| 29 | ||
| 30 | $this->success('Intent created.'); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 11-32 (lines=22) @@ | ||
| 8 | use FondBot\Conversation\ConversationCreator; |
|
| 9 | use Symfony\Component\Console\Input\InputArgument; |
|
| 10 | ||
| 11 | class MakeInteraction extends Command |
|
| 12 | { |
|
| 13 | protected function configure(): void |
|
| 14 | { |
|
| 15 | $this |
|
| 16 | ->setName('make:interaction') |
|
| 17 | ->setDescription('Create a new interaction class') |
|
| 18 | ->addArgument('name', InputArgument::REQUIRED, 'Name of intent'); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function handle(): void |
|
| 22 | { |
|
| 23 | $name = $this->getArgument('name'); |
|
| 24 | ||
| 25 | /** @var ConversationCreator $creator */ |
|
| 26 | $creator = $this->kernel->resolve(ConversationCreator::class); |
|
| 27 | ||
| 28 | $creator->createInteraction('src', 'App', $name); |
|
| 29 | ||
| 30 | $this->success('Interaction created.'); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||