forked from Bee-Lab/bowerphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Bowerphp. | ||
* | ||
* (c) Massimiliano Arione <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Bowerphp\Command\Helper; | ||
|
||
use Symfony\Component\Console\Helper\QuestionHelper as BaseDialogHelper; | ||
use Symfony\Component\Console\Question\Question; | ||
|
||
/** | ||
* Copied by Composer https://github.com/composer/composer | ||
*/ | ||
class QuestionHelper extends BaseDialogHelper | ||
{ | ||
/** | ||
* Build text for asking a question. For example: | ||
* | ||
* "Do you want to continue [yes]:" | ||
* | ||
* @param string $question The question you want to ask | ||
* @param mixed $default Default value to add to message, if false no default will be shown | ||
* @param string $sep Separation char for between message and user input | ||
* | ||
* @return string | ||
*/ | ||
public function getQuestion($question, $default = null, $sep = ':') | ||
{ | ||
return $default !== null ? | ||
new Question(sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep)) : | ||
new Question(sprintf('<info>%s</info>%s ', $question, $sep)); | ||
} | ||
} |