Yaffs site version 1.1
[yaffs-website] / vendor / symfony / console / Style / OutputStyle.php
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\OutputInterface;
17
18 /**
19  * Decorates output to add console style guide helpers.
20  *
21  * @author Kevin Bond <kevinbond@gmail.com>
22  */
23 abstract class OutputStyle implements OutputInterface, StyleInterface
24 {
25     private $output;
26
27     /**
28      * @param OutputInterface $output
29      */
30     public function __construct(OutputInterface $output)
31     {
32         $this->output = $output;
33     }
34
35     /**
36      * {@inheritdoc}
37      */
38     public function newLine($count = 1)
39     {
40         $this->output->write(str_repeat(PHP_EOL, $count));
41     }
42
43     /**
44      * @param int $max
45      *
46      * @return ProgressBar
47      */
48     public function createProgressBar($max = 0)
49     {
50         return new ProgressBar($this->output, $max);
51     }
52
53     /**
54      * {@inheritdoc}
55      */
56     public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
57     {
58         $this->output->write($messages, $newline, $type);
59     }
60
61     /**
62      * {@inheritdoc}
63      */
64     public function writeln($messages, $type = self::OUTPUT_NORMAL)
65     {
66         $this->output->writeln($messages, $type);
67     }
68
69     /**
70      * {@inheritdoc}
71      */
72     public function setVerbosity($level)
73     {
74         $this->output->setVerbosity($level);
75     }
76
77     /**
78      * {@inheritdoc}
79      */
80     public function getVerbosity()
81     {
82         return $this->output->getVerbosity();
83     }
84
85     /**
86      * {@inheritdoc}
87      */
88     public function setDecorated($decorated)
89     {
90         $this->output->setDecorated($decorated);
91     }
92
93     /**
94      * {@inheritdoc}
95      */
96     public function isDecorated()
97     {
98         return $this->output->isDecorated();
99     }
100
101     /**
102      * {@inheritdoc}
103      */
104     public function setFormatter(OutputFormatterInterface $formatter)
105     {
106         $this->output->setFormatter($formatter);
107     }
108
109     /**
110      * {@inheritdoc}
111      */
112     public function getFormatter()
113     {
114         return $this->output->getFormatter();
115     }
116 }