Zend_ProgressBar_Adapter_Console offers a text-based progressbar for console applications

category Zend
package Zend_ProgressBar
uses
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_ProgressBar_Adapter

 Methods

Defined by Zend_ProgressBar_Adapter

__construct(null|array|\Zend_Config $options = null

$options may be either be an array or a Zend_Config object which specifies adapter related options.

inherited_from \Zend_ProgressBar_Adapter::__construct()

Parameters

$options

nullarray\Zend_Config

Create a new adapter

__construct(null|array|\Zend_Config $options = null
Inherited

$options may be either be an array or a Zend_Config object which specifies adapter related options.

Parameters

$options

nullarray\Zend_Config

Close local stdout, when open

__destruct() 

Defined by Zend_ProgressBar_Adapter_Interface

finish() : void
inherited_from \Zend_ProgressBar_Adapter::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_Interface

notify(float $current, float $max, float $percent, integer $timeTaken, integer $timeRemaining, string $text) : void
inherited_from \Zend_ProgressBar_Adapter::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 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 When character is empty

Returns

\Zend_ProgressBar_Adapter_Console

Set the charset of the text element

setCharset(string $charset) 

Parameters

$charset

string

Set options via a Zend_Config instance

setConfig(\Zend_Config $config) : \Zend_ProgressBar_Adapter
Inherited

Parameters

$config

\Zend_Config

Returns

\Zend_ProgressBar_Adapter

Set the elements to display with the progressbar

setElements(array $elements) : \Zend_ProgressBar_Adapter_Console

Parameters

$elements

array

Exceptions

\Zend_ProgressBar_Adapter_Exception When an invalid element is foudn 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 When an invalid action is specified

Returns

\Zend_ProgressBar_Adapter_Console

Set options via an array

setOptions(array $options) : \Zend_ProgressBar_Adapter
Inherited

Parameters

$options

array

Returns

\Zend_ProgressBar_Adapter

Set a different output-stream

setOutputStream(string $resource) : \Zend_ProgressBar_Adapter_Console

Parameters

$resource

string

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
 

Wether 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'