Subversion-Projekte lars-tiefland.laravel_shop

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 Illuminate\Console\Contracts\NewLineAware;
6
use Symfony\Component\Console\Output\OutputInterface;
7
 
8
class Line extends Component
9
{
10
    /**
11
     * The possible line styles.
12
     *
13
     * @var array<string, array<string, string>>
14
     */
15
    protected static $styles = [
16
        'info' => [
17
            'bgColor' => 'blue',
18
            'fgColor' => 'white',
19
            'title' => 'info',
20
        ],
21
        'warn' => [
22
            'bgColor' => 'yellow',
23
            'fgColor' => 'black',
24
            'title' => 'warn',
25
        ],
26
        'error' => [
27
            'bgColor' => 'red',
28
            'fgColor' => 'white',
29
            'title' => 'error',
30
        ],
31
    ];
32
 
33
    /**
34
     * Renders the component using the given arguments.
35
     *
36
     * @param  string  $style
37
     * @param  string  $string
38
     * @param  int  $verbosity
39
     * @return void
40
     */
41
    public function render($style, $string, $verbosity = OutputInterface::VERBOSITY_NORMAL)
42
    {
43
        $string = $this->mutate($string, [
44
            Mutators\EnsureDynamicContentIsHighlighted::class,
45
            Mutators\EnsurePunctuation::class,
46
            Mutators\EnsureRelativePaths::class,
47
        ]);
48
 
49
        $this->renderView('line', array_merge(static::$styles[$style], [
50
            'marginTop' => ($this->output instanceof NewLineAware && $this->output->newLineWritten()) ? 0 : 1,
51
            'content' => $string,
52
        ]), $verbosity);
53
    }
54
}