Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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