Skip to content
This repository was archived by the owner on Jul 8, 2024. It is now read-only.

Commit 1b9e01a

Browse files
committed
Merge pull request #134 from lexxorlov/master
Added helper for SF3
2 parents 251e618 + b1abd73 commit 1b9e01a

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Bowerphp.
5+
*
6+
* (c) Massimiliano Arione <massimiliano.arione@bee-lab.net>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Bowerphp\Command\Helper;
13+
14+
use Symfony\Component\Console\Helper\QuestionHelper as BaseDialogHelper;
15+
use Symfony\Component\Console\Question\Question;
16+
17+
/**
18+
* Copied by Composer https://github.com/composer/composer
19+
*/
20+
class QuestionHelper extends BaseDialogHelper
21+
{
22+
/**
23+
* Build text for asking a question. For example:
24+
*
25+
* "Do you want to continue [yes]:"
26+
*
27+
* @param string $question The question you want to ask
28+
* @param mixed $default Default value to add to message, if false no default will be shown
29+
* @param string $sep Separation char for between message and user input
30+
*
31+
* @return string
32+
*/
33+
public function getQuestion($question, $default = null, $sep = ':')
34+
{
35+
return $default !== null ?
36+
new Question(sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep)) :
37+
new Question(sprintf('<info>%s</info>%s ', $question, $sep));
38+
}
39+
}

0 commit comments

Comments
 (0)