comparison vendor/symfony/console/Style/SymfonyStyle.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
38 private $questionHelper; 38 private $questionHelper;
39 private $progressBar; 39 private $progressBar;
40 private $lineLength; 40 private $lineLength;
41 private $bufferedOutput; 41 private $bufferedOutput;
42 42
43 /**
44 * @param InputInterface $input
45 * @param OutputInterface $output
46 */
47 public function __construct(InputInterface $input, OutputInterface $output) 43 public function __construct(InputInterface $input, OutputInterface $output)
48 { 44 {
49 $this->input = $input; 45 $this->input = $input;
50 $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter()); 46 $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
51 // Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not. 47 // Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
61 * @param string|array $messages The message to write in the block 57 * @param string|array $messages The message to write in the block
62 * @param string|null $type The block type (added in [] on first line) 58 * @param string|null $type The block type (added in [] on first line)
63 * @param string|null $style The style to apply to the whole block 59 * @param string|null $style The style to apply to the whole block
64 * @param string $prefix The prefix for the block 60 * @param string $prefix The prefix for the block
65 * @param bool $padding Whether to add vertical padding 61 * @param bool $padding Whether to add vertical padding
66 */ 62 * @param bool $escape Whether to escape the message
67 public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false) 63 */
64 public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true)
68 { 65 {
69 $messages = is_array($messages) ? array_values($messages) : array($messages); 66 $messages = is_array($messages) ? array_values($messages) : array($messages);
70 67
71 $this->autoPrependBlock(); 68 $this->autoPrependBlock();
72 $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true)); 69 $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
73 $this->newLine(); 70 $this->newLine();
74 } 71 }
75 72
76 /** 73 /**
77 * {@inheritdoc} 74 * {@inheritdoc}
131 * 128 *
132 * @param string|array $message 129 * @param string|array $message
133 */ 130 */
134 public function comment($message) 131 public function comment($message)
135 { 132 {
136 $messages = is_array($message) ? array_values($message) : array($message); 133 $this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
137
138 $this->autoPrependBlock();
139 $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
140 $this->newLine();
141 } 134 }
142 135
143 /** 136 /**
144 * {@inheritdoc} 137 * {@inheritdoc}
145 */ 138 */
284 277
285 return $progressBar; 278 return $progressBar;
286 } 279 }
287 280
288 /** 281 /**
289 * @param Question $question 282 * @return mixed
290 *
291 * @return string
292 */ 283 */
293 public function askQuestion(Question $question) 284 public function askQuestion(Question $question)
294 { 285 {
295 if ($this->input->isInteractive()) { 286 if ($this->input->isInteractive()) {
296 $this->autoPrependBlock(); 287 $this->autoPrependBlock();
333 */ 324 */
334 public function newLine($count = 1) 325 public function newLine($count = 1)
335 { 326 {
336 parent::newLine($count); 327 parent::newLine($count);
337 $this->bufferedOutput->write(str_repeat("\n", $count)); 328 $this->bufferedOutput->write(str_repeat("\n", $count));
329 }
330
331 /**
332 * Returns a new instance which makes use of stderr if available.
333 *
334 * @return self
335 */
336 public function getErrorStyle()
337 {
338 return new self($this->input, $this->getErrorOutput());
338 } 339 }
339 340
340 /** 341 /**
341 * @return ProgressBar 342 * @return ProgressBar
342 */ 343 */