Multiselect   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 10 1
1
<?php
2
3
namespace TheAentMachine\Prompt;
4
5
use Symfony\Component\Console\Question\ChoiceQuestion;
6
use Symfony\Component\Console\Question\Question;
7
8
final class Multiselect extends Select
9
{
10
    /**
11
     * @return Question
12
     */
13
    protected function build(): Question
14
    {
15
        $this->multiselect = true;
16
        $question = parent::build();
17
        $message = $question->getQuestion();
18
        $validator = $question->getValidator();
19
        $question = new ChoiceQuestion($message, $this->items, $this->default);
20
        $question->setValidator($validator);
21
        $question->setMultiselect(true);
22
        return $question;
23
    }
24
}
25