Total Complexity | 4 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class BaseCommand extends Command |
||
9 | { |
||
10 | /** |
||
11 | * Overwrite previous line with new message. |
||
12 | * |
||
13 | * @param string $string |
||
14 | * @param string $style |
||
15 | * @param null|int|string $verbosity |
||
16 | */ |
||
17 | protected function overwrite($string, $style = null, $verbosity = null) |
||
18 | { |
||
19 | if ($this->output->isDecorated()) { |
||
20 | // Move the cursor to the beginning of the line |
||
21 | $this->output->write("\x0D"); |
||
22 | |||
23 | // Erase the line |
||
24 | $this->output->write("\x1B[2K"); |
||
25 | } |
||
26 | |||
27 | $styled = $style ? "<$style>$string</$style>" : $string; |
||
28 | |||
29 | $this->output->write($styled, false, $this->parseVerbosity($verbosity)); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Add common styles. |
||
34 | */ |
||
35 | protected function addStyles() |
||
39 | } |
||
40 | } |
||
41 |