Zend\ProgressBar\Adapter\Console
Zend\ProgressBar\Adapter\Console offers a text-based progressbar for console applications
Synopsis
class Console
extends AbstractAdapter
{
- // constants
- const ELEMENT_PERCENT = 'ELEMENT_PERCENT';
- const ELEMENT_BAR = 'ELEMENT_BAR';
- const ELEMENT_ETA = 'ELEMENT_ETA';
- const ELEMENT_TEXT = 'ELEMENT_TEXT';
- const FINISH_ACTION_EOL = 'FINISH_ACTION_EOL';
- const FINISH_ACTION_CLEAR_LINE = 'FINISH_ACTION_CLEAR_LINE';
- const FINISH_ACTION_NONE = 'FINISH_ACTION_NONE';
- // members
- protected int $width;
- protected array $elements;
- protected string $finishAction;
- protected int $barWidth;
- protected string $barLeftChar;
- protected string $barIndicatorChar;
- protected string $barRightChar;
- protected resource $outputStream;
- protected integer $textWidth;
- protected bool $outputStarted;
- protected string $charset;
- // Inherited members from AbstractAdapter
- protected array $skipOptions;
- // methods
- public void __construct()
- public void __destruct()
- public Console setOutputStream()
- public resource getOutputStream()
- public Console setWidth()
- public Console setElements()
- public Console setBarLeftChar()
- public Console setBarRightChar()
- public Console setBarIndicatorChar()
- public Console setTextWidth()
- public void setCharset()
- public Console setFinishAction()
- public void notify()
- public void finish()
- protected void _calculateBarWidth()
- protected void _outputData()
- // Inherited methods from AbstractAdapter
- public void __construct()
- public AbstractAdapter setOptions()
- public abstract void notify()
- public abstract void finish()
Hierarchy
Constants
Name | Value |
---|---|
ELEMENT_PERCENT | 'ELEMENT_PERCENT' |
ELEMENT_BAR | 'ELEMENT_BAR' |
ELEMENT_ETA | 'ELEMENT_ETA' |
ELEMENT_TEXT | 'ELEMENT_TEXT' |
FINISH_ACTION_EOL | 'FINISH_ACTION_EOL' |
FINISH_ACTION_CLEAR_LINE | 'FINISH_ACTION_CLEAR_LINE' |
FINISH_ACTION_NONE | 'FINISH_ACTION_NONE' |
Members
protected
- $barIndicatorChar
—
string
Indicator character(s) within the bar - $barLeftChar
—
string
Left character(s) within the bar - $barRightChar
—
string
Right character(s) within the bar - $barWidth
—
int
Width of the bar element - $charset
—
string
Charset of text element - $elements
—
array
Elements to display - $finishAction
—
string
Which action to do at finish call - $outputStarted
—
Zend\ProgressBar\Adapter\bool
Whether the output started yet or not - $outputStream
—
resource
Output-stream, when STDOUT is not defined (e.g. in CGI) or set manually - $skipOptions
—
array
Option keys to skip when calling setOptions() - $textWidth
—
string
Width of the text element - $width
—
int
Width of the progressbar
Methods
protected
- _calculateBarWidth() — Calculate the bar width when other elements changed
- _outputData() — Outputs given data to STDOUT.
public
- __construct() — Defined by Zend\ProgressBar adapter
- __destruct() — Close local stdout, when open
- finish() — Defined by Zend\ProgressBar\Adapter\AbstractAdapter
- getOutputStream() — Get the current output stream
- notify() — Defined by Zend\ProgressBar\Adapter\AbstractAdapter
- setBarIndicatorChar() — Set the indicator character for the bar
- setBarLeftChar() — Set the left-hand character for the bar
- setBarRightChar() — Set the right-hand character for the bar
- setCharset() — Set the charset of the text element
- setElements() — Set the elements to display with the progressbar
- setFinishAction() — Set the finish action
- setOutputStream() — Set a different output-stream
- setTextWidth() — Set the width of the text element
- setWidth() — Set the width of the progressbar
Inherited from Zend\ProgressBar\Adapter\AbstractAdapter
public
- finish() — Called when the progress is explicitly finished
- notify() — Notify the adapter about an update
- setOptions() — Set options via an array