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;
4
 
5
use Illuminate\Console\Contracts\NewLineAware;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Symfony\Component\Console\Style\SymfonyStyle;
9
 
10
class OutputStyle extends SymfonyStyle implements NewLineAware
11
{
12
    /**
13
     * The output instance.
14
     *
15
     * @var \Symfony\Component\Console\Output\OutputInterface
16
     */
17
    private $output;
18
 
19
    /**
20
     * If the last output written wrote a new line.
21
     *
22
     * @var bool
23
     */
24
    protected $newLineWritten = false;
25
 
26
    /**
27
     * Create a new Console OutputStyle instance.
28
     *
29
     * @param  \Symfony\Component\Console\Input\InputInterface  $input
30
     * @param  \Symfony\Component\Console\Output\OutputInterface  $output
31
     * @return void
32
     */
33
    public function __construct(InputInterface $input, OutputInterface $output)
34
    {
35
        $this->output = $output;
36
 
37
        parent::__construct($input, $output);
38
    }
39
 
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function write(string|iterable $messages, bool $newline = false, int $options = 0)
44
    {
45
        $this->newLineWritten = $newline;
46
 
47
        parent::write($messages, $newline, $options);
48
    }
49
 
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL)
54
    {
55
        $this->newLineWritten = true;
56
 
57
        parent::writeln($messages, $type);
58
    }
59
 
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function newLine(int $count = 1)
64
    {
65
        $this->newLineWritten = $count > 0;
66
 
67
        parent::newLine($count);
68
    }
69
 
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function newLineWritten()
74
    {
75
        if ($this->output instanceof static && $this->output->newLineWritten()) {
76
            return true;
77
        }
78
 
79
        return $this->newLineWritten;
80
    }
81
 
82
    /**
83
     * Returns whether verbosity is quiet (-q).
84
     *
85
     * @return bool
86
     */
87
    public function isQuiet(): bool
88
    {
89
        return $this->output->isQuiet();
90
    }
91
 
92
    /**
93
     * Returns whether verbosity is verbose (-v).
94
     *
95
     * @return bool
96
     */
97
    public function isVerbose(): bool
98
    {
99
        return $this->output->isVerbose();
100
    }
101
 
102
    /**
103
     * Returns whether verbosity is very verbose (-vv).
104
     *
105
     * @return bool
106
     */
107
    public function isVeryVerbose(): bool
108
    {
109
        return $this->output->isVeryVerbose();
110
    }
111
 
112
    /**
113
     * Returns whether verbosity is debug (-vvv).
114
     *
115
     * @return bool
116
     */
117
    public function isDebug(): bool
118
    {
119
        return $this->output->isDebug();
120
    }
121
 
122
    /**
123
     * Get the underlying Symfony output implementation.
124
     *
125
     * @return \Symfony\Component\Console\Output\OutputInterface
126
     */
127
    public function getOutput()
128
    {
129
        return $this->output;
130
    }
131
}