Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Symfony\Component\Console\Style;
13
 
14
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
15
use Symfony\Component\Console\Helper\ProgressBar;
16
use Symfony\Component\Console\Output\ConsoleOutputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
 
19
/**
20
 * Decorates output to add console style guide helpers.
21
 *
22
 * @author Kevin Bond <kevinbond@gmail.com>
23
 */
24
abstract class OutputStyle implements OutputInterface, StyleInterface
25
{
26
    private OutputInterface $output;
27
 
28
    public function __construct(OutputInterface $output)
29
    {
30
        $this->output = $output;
31
    }
32
 
33
    public function newLine(int $count = 1)
34
    {
35
        $this->output->write(str_repeat(\PHP_EOL, $count));
36
    }
37
 
38
    public function createProgressBar(int $max = 0): ProgressBar
39
    {
40
        return new ProgressBar($this->output, $max);
41
    }
42
 
43
    public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL)
44
    {
45
        $this->output->write($messages, $newline, $type);
46
    }
47
 
48
    public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL)
49
    {
50
        $this->output->writeln($messages, $type);
51
    }
52
 
53
    public function setVerbosity(int $level)
54
    {
55
        $this->output->setVerbosity($level);
56
    }
57
 
58
    public function getVerbosity(): int
59
    {
60
        return $this->output->getVerbosity();
61
    }
62
 
63
    public function setDecorated(bool $decorated)
64
    {
65
        $this->output->setDecorated($decorated);
66
    }
67
 
68
    public function isDecorated(): bool
69
    {
70
        return $this->output->isDecorated();
71
    }
72
 
73
    public function setFormatter(OutputFormatterInterface $formatter)
74
    {
75
        $this->output->setFormatter($formatter);
76
    }
77
 
78
    public function getFormatter(): OutputFormatterInterface
79
    {
80
        return $this->output->getFormatter();
81
    }
82
 
83
    public function isQuiet(): bool
84
    {
85
        return $this->output->isQuiet();
86
    }
87
 
88
    public function isVerbose(): bool
89
    {
90
        return $this->output->isVerbose();
91
    }
92
 
93
    public function isVeryVerbose(): bool
94
    {
95
        return $this->output->isVeryVerbose();
96
    }
97
 
98
    public function isDebug(): bool
99
    {
100
        return $this->output->isDebug();
101
    }
102
 
103
    protected function getErrorOutput()
104
    {
105
        if (!$this->output instanceof ConsoleOutputInterface) {
106
            return $this->output;
107
        }
108
 
109
        return $this->output->getErrorOutput();
110
    }
111
}