Created
February 6, 2022 12:51
-
-
Save osteel/b2ccd0597cee8e137ac46e8db37362a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Osteel\PhpCliDemo\Services; | |
use Symfony\Component\Console\Style\SymfonyStyle; | |
class InputOutput extends SymfonyStyle | |
{ | |
/** | |
* Ask a question and return the answer. | |
*/ | |
public function question(string $question): string | |
{ | |
return $this->ask(sprintf(' ✍️ %s', $question)); | |
} | |
/** | |
* Display a message in case of right answer. | |
*/ | |
public function right(string $message): void | |
{ | |
$this->block(sprintf(' 🎉 %s', $message), null, 'fg=white;bg=green', ' ', true); | |
} | |
/** | |
* Display a message in case of wrong answer. | |
*/ | |
public function wrong(string $message): void | |
{ | |
$this->block(sprintf(' 😮 %s', $message), null, 'fg=white;bg=red', ' ', true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment