|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* AnimeDb package. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Peter Gribanov <[email protected]> |
|
6
|
|
|
* @copyright Copyright (c) 2011, Peter Gribanov |
|
7
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 GPL v3 |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace AnimeDb\Bundle\CatalogBundle\Console\Output; |
|
11
|
|
|
|
|
12
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
13
|
|
|
use Symfony\Component\Console\Formatter\OutputFormatterInterface; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Decorator for output. |
|
17
|
|
|
* |
|
18
|
|
|
* @author Peter Gribanov <[email protected]> |
|
19
|
|
|
*/ |
|
20
|
|
|
abstract class Decorator implements OutputInterface |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* @var OutputInterface |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $output; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @param OutputInterface $output |
|
29
|
|
|
*/ |
|
30
|
138 |
|
public function __construct(OutputInterface $output) |
|
31
|
|
|
{ |
|
32
|
138 |
|
$this->output = $output; |
|
33
|
138 |
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @param array|string $messages |
|
37
|
|
|
* @param bool|false $newline |
|
38
|
|
|
* @param int $type |
|
39
|
|
|
*/ |
|
40
|
61 |
|
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL) |
|
41
|
|
|
{ |
|
42
|
61 |
|
$this->output->write($messages, $newline, $type); |
|
43
|
61 |
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param array|string $messages |
|
47
|
|
|
* @param int $type |
|
48
|
|
|
*/ |
|
49
|
48 |
|
public function writeln($messages, $type = self::OUTPUT_NORMAL) |
|
50
|
|
|
{ |
|
51
|
48 |
|
$this->output->writeln($messages, $type); |
|
52
|
48 |
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @param int $level |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public function setVerbosity($level) |
|
58
|
|
|
{ |
|
59
|
1 |
|
$this->output->setVerbosity($level); |
|
60
|
1 |
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return int |
|
64
|
|
|
*/ |
|
65
|
1 |
|
public function getVerbosity() |
|
66
|
|
|
{ |
|
67
|
1 |
|
return $this->output->getVerbosity(); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param bool $decorated |
|
72
|
|
|
*/ |
|
73
|
2 |
|
public function setDecorated($decorated) |
|
74
|
|
|
{ |
|
75
|
2 |
|
$this->output->setDecorated($decorated); |
|
76
|
2 |
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return bool |
|
80
|
|
|
*/ |
|
81
|
2 |
|
public function isDecorated() |
|
82
|
|
|
{ |
|
83
|
2 |
|
return $this->output->isDecorated(); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @param OutputFormatterInterface $formatter |
|
88
|
|
|
*/ |
|
89
|
1 |
|
public function setFormatter(OutputFormatterInterface $formatter) |
|
90
|
|
|
{ |
|
91
|
1 |
|
$this->output->setFormatter($formatter); |
|
92
|
1 |
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return OutputFormatterInterface |
|
96
|
|
|
*/ |
|
97
|
1 |
|
public function getFormatter() |
|
98
|
|
|
{ |
|
99
|
1 |
|
return $this->output->getFormatter(); |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|