Subversion-Projekte lars-tiefland.laravel_shop

Revision

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