Zend\ProgressBar\Adapter\Console offers a text-based progressbar for console applications

package Default
inherited_from \Zend\ProgressBar\Adapter\AbstractAdapter

 Methods

Defined by Zend\ProgressBar adapter

__construct(array|\Traversable $options = null

$options may be either be an array or a Zend\Config object which specifies adapter related options.

inherited_from \Zend\ProgressBar\Adapter\AbstractAdapter::__construct()

Parameters

$options

array\Traversable

Create a new adapter

__construct(array|\Traversable $options = null
Inherited

$options may be either be an array or a Zend\Config object which specifies adapter related options.

Parameters

$options

array\Traversable

Close local stdout, when open

__destruct() 

Defined by Zend\ProgressBar\Adapter\AbstractAdapter

finish() : void
inherited_from \Zend\ProgressBar\Adapter\AbstractAdapter::finish()

Called when the progress is explicitly finished

finish() : void
Inherited

Get the current output stream

getOutputStream() : resource

Returns

resource

Defined by Zend\ProgressBar\Adapter\AbstractAdapter

notify(float $current, float $max, float $percent, integer $timeTaken, integer $timeRemaining, string $text) : void
inherited_from \Zend\ProgressBar\Adapter\AbstractAdapter::notify()

Parameters

$current

float

Current progress value

$max

float

Max progress value

$percent

float

Current percent value

$timeTaken

integer

Taken time in seconds

$timeRemaining

integer

Remaining time in seconds

$text

string

Status text

Notify the adapter about an update

notify(float $current, float $max, float $percent, integer $timeTaken, integer $timeRemaining, string $text) : void
Inherited

Parameters

$current

float

Current progress value

$max

float

Max progress value

$percent

float

Current percent value

$timeTaken

integer

Taken time in seconds

$timeRemaining

integer

Remaining time in seconds

$text

string

Status text

Set the indicator character for the bar

setBarIndicatorChar(string $char) : \Zend\ProgressBar\Adapter\Console

Parameters

$char

string

Returns

\Zend\ProgressBar\Adapter\Console

Set the left-hand character for the bar

setBarLeftChar(string $char) : \Zend\ProgressBar\Adapter\Console

Parameters

$char

string

Exceptions

\Zend\ProgressBar\Adapter\Exception\InvalidArgumentException When character is empty

Returns

\Zend\ProgressBar\Adapter\Console

Set the right-hand character for the bar

setBarRightChar(string $char) : \Zend\ProgressBar\Adapter\Console

Parameters

$char

string

Exceptions

\Zend\ProgressBar\Adapter\Exception\InvalidArgumentException When character is empty

Returns

\Zend\ProgressBar\Adapter\Console

Set the charset of the text element

setCharset(string $charset) 

Parameters

$charset

string

Set the elements to display with the progressbar

setElements(array $elements) : \Zend\ProgressBar\Adapter\Console

Parameters

$elements

array

Exceptions

\Zend\ProgressBar\Adapter\Exception\InvalidArgumentException When an invalid element is found in the array

Returns

\Zend\ProgressBar\Adapter\Console

Set the finish action

setFinishAction(string $action) : \Zend\ProgressBar\Adapter\Console

Parameters

$action

string

Exceptions

\Zend\ProgressBar\Adapter\Exception\InvalidArgumentException When an invalid action is specified

Returns

\Zend\ProgressBar\Adapter\Console

Set options via an array

setOptions(array $options) : \Zend\ProgressBar\Adapter\AbstractAdapter
Inherited

Parameters

$options

array

Returns

\Zend\ProgressBar\Adapter\AbstractAdapter

Set a different output-stream

setOutputStream(string $resource) : \Zend\ProgressBar\Adapter\Console

Parameters

$resource

string

Exceptions

\Zend\ProgressBar\Adapter\Exception\RuntimeException

Returns

\Zend\ProgressBar\Adapter\Console

Set the width of the text element

setTextWidth(integer $width) : \Zend\ProgressBar\Adapter\Console

Parameters

$width

integer

Returns

\Zend\ProgressBar\Adapter\Console

Set the width of the progressbar

setWidth(integer $width = null) : \Zend\ProgressBar\Adapter\Console

Parameters

$width

integer

Returns

\Zend\ProgressBar\Adapter\Console

Calculate the bar width when other elements changed

_calculateBarWidth() : void

Outputs given data to STDOUT.

_outputData(string $data) : void

This split-off is required for unit-testing.

Parameters

$data

string

 Properties

 

Indicator character(s) within the bar

$barIndicatorChar : string

Default

''
 

Left character(s) within the bar

$barLeftChar : string

Default

'#'
 

Right character(s) within the bar

$barRightChar : string

Default

'-'
 

Width of the bar element

$barWidth : integer

Default

 

Charset of text element

$charset : string

Default

'utf-8'
 

Elements to display

$elements : array

Default

array(self::ELEMENT_PERCENT, self::ELEMENT_BAR, self::ELEMENT_ETA)
 

Which action to do at finish call

$finishAction : string

Default

self::FINISH_ACTION_EOL
 

Whether the output started yet or not

$outputStarted : boolean

Default

false
 

Output-stream, when STDOUT is not defined (e.g. in CGI) or set manually

$outputStream : resource

Default

null
 

Option keys to skip when calling setOptions()

$skipOptions : array

Default

array('options', 'config')
 

Width of the text element

$textWidth : string

Default

20
 

Width of the progressbar

$width : integer

Default

null

 Constants

 

Visual value of the progress

ELEMENT_BAR = 'ELEMENT_BAR' 
 

ETA of the progress

ELEMENT_ETA = 'ELEMENT_ETA' 
 

Percentage value of the progress

ELEMENT_PERCENT = 'ELEMENT_PERCENT' 
 

Text part of the progress

ELEMENT_TEXT = 'ELEMENT_TEXT' 
 

Finish action: Clear Line

FINISH_ACTION_CLEAR_LINE = 'FINISH_ACTION_CLEAR_LINE' 
 

Finish action: End of Line

FINISH_ACTION_EOL = 'FINISH_ACTION_EOL' 
 

Finish action: None

FINISH_ACTION_NONE = 'FINISH_ACTION_NONE'