QuestionHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
cbo 2
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getQuestion() 0 6 2
1
<?php
2
3
/*
4
 * This file is part of Bowerphp.
5
 *
6
 * (c) Massimiliano Arione <[email protected]>
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 BaseQuestionHelper;
15
use Symfony\Component\Console\Question\Question;
16
17
/**
18
 * Copied by Composer https://github.com/composer/composer
19
 */
20
class QuestionHelper extends BaseQuestionHelper
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 null !== $default ?
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
}
40