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 InvalidArgumentException;
6
 
7
/**
8
 * @method void alert(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
399 lars 9
 * @method mixed ask(string $question, string $default = null)
10
 * @method mixed askWithCompletion(string $question, array|callable $choices, string $default = null)
148 lars 11
 * @method void bulletList(array $elements, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
399 lars 12
 * @method mixed choice(string $question, array $choices, $default = null, int $attempts = null, bool $multiple = false)
148 lars 13
 * @method bool confirm(string $question, bool $default = false)
14
 * @method void error(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
15
 * @method void info(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
16
 * @method void line(string $style, string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
17
 * @method void task(string $description, ?callable $task = null, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
18
 * @method void twoColumnDetail(string $first, ?string $second = null, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
19
 * @method void warn(string $string, int $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL)
20
 */
21
class Factory
22
{
23
    /**
24
     * The output interface implementation.
25
     *
26
     * @var \Illuminate\Console\OutputStyle
27
     */
28
    protected $output;
29
 
30
    /**
31
     * Creates a new factory instance.
32
     *
33
     * @param  \Illuminate\Console\OutputStyle  $output
34
     * @return void
35
     */
36
    public function __construct($output)
37
    {
38
        $this->output = $output;
39
    }
40
 
41
    /**
42
     * Dynamically handle calls into the component instance.
43
     *
44
     * @param  string  $method
45
     * @param  array  $parameters
46
     * @return mixed
47
     *
48
     * @throws \InvalidArgumentException
49
     */
50
    public function __call($method, $parameters)
51
    {
52
        $component = '\Illuminate\Console\View\Components\\'.ucfirst($method);
53
 
54
        throw_unless(class_exists($component), new InvalidArgumentException(sprintf(
55
            'Console component [%s] not found.', $method
56
        )));
57
 
58
        return with(new $component($this->output))->render(...$parameters);
59
    }
60
}