Completed
Push — master ( 328402...1cd18c )
by Julien
587:13 queued 584:54
created

Multiselect::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
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