Skip to content

Commit d92f3ea

Browse files
committed
[Console] added explanation of messages usage in a progress bar
1 parent a77431c commit d92f3ea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Symfony/Component/Console/Helper/ProgressBar.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ProgressBar
4141
private $stepWidth;
4242
private $percent = 0.0;
4343
private $formatLineCount;
44-
private $messages;
44+
private $messages = array();
4545
private $overwrite = true;
4646

4747
private static $formatters;
@@ -139,6 +139,16 @@ public static function getFormatDefinition($name)
139139
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
140140
}
141141

142+
/**
143+
* Associates a text with a named placeholder.
144+
*
145+
* The text is displayed when the progress bar is rendered but only
146+
* when the corresponding placeholder is part of the custom format line
147+
* (by wrapping the name with %).
148+
*
149+
* @param string $message The text to associate with the placeholder
150+
* @param string $name The name of the placeholder
151+
*/
142152
public function setMessage($message, $name = 'message')
143153
{
144154
$this->messages[$name] = $message;

0 commit comments

Comments
 (0)