Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Console\View\Components;
4
 
5
use Symfony\Component\Console\Question\ChoiceQuestion;
6
 
7
class Choice extends Component
8
{
9
    /**
10
     * Renders the component using the given arguments.
11
     *
12
     * @param  string  $question
13
     * @param  array<array-key, string>  $choices
14
     * @param  mixed  $default
399 lars 15
     * @param  int  $attempts
16
     * @param  bool  $multiple
148 lars 17
     * @return mixed
18
     */
399 lars 19
    public function render($question, $choices, $default = null, $attempts = null, $multiple = false)
148 lars 20
    {
21
        return $this->usingQuestionHelper(
22
            fn () => $this->output->askQuestion(
399 lars 23
                (new ChoiceQuestion($question, $choices, $default))
24
                    ->setMaxAttempts($attempts)
25
                    ->setMultiselect($multiple)
148 lars 26
            ),
27
        );
28
    }
29
}