GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ParameterHelper::askParameter()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 3
1
<?php
2
namespace Naneau\FileGen\Console\Helper;
3
4
use Naneau\FileGen\Structure;
5
use Naneau\FileGen\Parameter\Parameter;
6
7
use Symfony\Component\Console\Helper\HelperInterface;
8
use Symfony\Component\Console\Helper\HelperSet;
9
use Symfony\Component\Console\Helper\QuestionHelper;
10
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
use Symfony\Component\Console\Question\Question;
14
15
/**
16
 * Asks questions on the console
17
 */
18
class ParameterHelper implements HelperInterface
19
{
20
    /**
21
     * The helperset
22
     *
23
     * @var HelperSet
24
     **/
25
    private $helperSet;
26
27
    /**
28
     * Ask for a parameter's value
29
     *
30
     * @param  Structure           $structure
31
     * @param  InputInterface      $input
32
     * @param  OutputInterface     $output
33
     * @return array[string]string the parameter set as a key/value hash for use in a generator
0 ignored issues
show
Documentation introduced by
The doc-type array[string]string could not be parsed: Expected "]" at position 2, but found "string". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
34
     **/
35
    public function askParameters(Structure $structure, InputInterface $input, OutputInterface $output)
36
    {
37
        $parameters = array();
38
        foreach($structure->getParameterDefinition() as $parameter) {
39
            $parameters[$parameter->getName()] = $this->askParameter(
40
                $parameter,
41
                $input,
42
                $output
43
            );
44
        }
45
        return $parameters;
46
    }
47
48
    /**
49
     * Ask for a parameter's value
50
     *
51
     * @param  Parameter           $parameter
52
     * @param  InputInterface      $input
53
     * @param  OutputInterface     $output
54
     * @return array[string]string the parameter set as a key/value hash for use in a generator
0 ignored issues
show
Documentation introduced by
The doc-type array[string]string could not be parsed: Expected "]" at position 2, but found "string". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
55
     **/
56
    public function askParameter(Parameter $parameter, InputInterface $input, OutputInterface $output)
57
    {
58
        if ($parameter->hasDefaultValue()) {
59
            $question = new Question($parameter->getDescription(), $parameter->getDefaultValue());
60
        } else {
61
            $question = new Question($parameter->getDescription());
62
        }
63
64
        return $this->getQuestionHelper()->ask($input, $output, $question);
65
    }
66
67
    /**
68
     * Sets the helper set associated with this helper.
69
     *
70
     * @param HelperSet $helperSet A HelperSet instance
71
     */
72
    public function setHelperSet(HelperSet $helperSet = null)
73
    {
74
        $this->helperSet = $helperSet;
75
    }
76
77
    /**
78
     * Gets the helper set associated with this helper.
79
     *
80
     * @return HelperSet A HelperSet instance
81
     */
82
    public function getHelperSet()
83
    {
84
        return $this->helperSet;
85
    }
86
87
    /**
88
     * Returns the canonical name of this helper.
89
     *
90
     * @return string The canonical name
91
     */
92
    public function getName()
93
    {
94
        return 'filegenParameters';
95
    }
96
97
    /**
98
     * Get the question helper
99
     *
100
     * @return QuestionHelper
101
     **/
102
    private function getQuestionHelper()
103
    {
104
        return $this->getHelperSet()->get('question');
105
    }
106
}
107