diff options
Diffstat (limited to 'vendor/symfony/console/Style/OutputStyle.php')
-rw-r--r-- | vendor/symfony/console/Style/OutputStyle.php | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/vendor/symfony/console/Style/OutputStyle.php b/vendor/symfony/console/Style/OutputStyle.php new file mode 100644 index 0000000..9f62ea3 --- /dev/null +++ b/vendor/symfony/console/Style/OutputStyle.php | |||
@@ -0,0 +1,109 @@ | |||
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 | public function __construct( | ||
27 | private OutputInterface $output, | ||
28 | ) { | ||
29 | } | ||
30 | |||
31 | public function newLine(int $count = 1): void | ||
32 | { | ||
33 | $this->output->write(str_repeat(\PHP_EOL, $count)); | ||
34 | } | ||
35 | |||
36 | public function createProgressBar(int $max = 0): ProgressBar | ||
37 | { | ||
38 | return new ProgressBar($this->output, $max); | ||
39 | } | ||
40 | |||
41 | public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL): void | ||
42 | { | ||
43 | $this->output->write($messages, $newline, $type); | ||
44 | } | ||
45 | |||
46 | public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL): void | ||
47 | { | ||
48 | $this->output->writeln($messages, $type); | ||
49 | } | ||
50 | |||
51 | public function setVerbosity(int $level): void | ||
52 | { | ||
53 | $this->output->setVerbosity($level); | ||
54 | } | ||
55 | |||
56 | public function getVerbosity(): int | ||
57 | { | ||
58 | return $this->output->getVerbosity(); | ||
59 | } | ||
60 | |||
61 | public function setDecorated(bool $decorated): void | ||
62 | { | ||
63 | $this->output->setDecorated($decorated); | ||
64 | } | ||
65 | |||
66 | public function isDecorated(): bool | ||
67 | { | ||
68 | return $this->output->isDecorated(); | ||
69 | } | ||
70 | |||
71 | public function setFormatter(OutputFormatterInterface $formatter): void | ||
72 | { | ||
73 | $this->output->setFormatter($formatter); | ||
74 | } | ||
75 | |||
76 | public function getFormatter(): OutputFormatterInterface | ||
77 | { | ||
78 | return $this->output->getFormatter(); | ||
79 | } | ||
80 | |||
81 | public function isQuiet(): bool | ||
82 | { | ||
83 | return $this->output->isQuiet(); | ||
84 | } | ||
85 | |||
86 | public function isVerbose(): bool | ||
87 | { | ||
88 | return $this->output->isVerbose(); | ||
89 | } | ||
90 | |||
91 | public function isVeryVerbose(): bool | ||
92 | { | ||
93 | return $this->output->isVeryVerbose(); | ||
94 | } | ||
95 | |||
96 | public function isDebug(): bool | ||
97 | { | ||
98 | return $this->output->isDebug(); | ||
99 | } | ||
100 | |||
101 | protected function getErrorOutput(): OutputInterface | ||
102 | { | ||
103 | if (!$this->output instanceof ConsoleOutputInterface) { | ||
104 | return $this->output; | ||
105 | } | ||
106 | |||
107 | return $this->output->getErrorOutput(); | ||
108 | } | ||
109 | } | ||