API Documentation

ProgressBar/Adapter/Console.php

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_ProgressBar  
version
$Id: Console.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_ProgressBar_Adapter_Console

Zend_ProgressBar_Adapter_Console offers a text-based progressbar for console applications

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

Constants

Constant  ELEMENT_PERCENT = 'ELEMENT_PERCENT'

Percentage value of the progress

Constant  ELEMENT_BAR = 'ELEMENT_BAR'

Visual value of the progress

Constant  ELEMENT_ETA = 'ELEMENT_ETA'

ETA of the progress

Constant  ELEMENT_TEXT = 'ELEMENT_TEXT'

Text part of the progress

Constant  FINISH_ACTION_EOL = 'FINISH_ACTION_EOL'

Finish action: End of Line

Constant  FINISH_ACTION_CLEAR_LINE = 'FINISH_ACTION_CLEAR_LINE'

Finish action: Clear Line

Constant  FINISH_ACTION_NONE = 'FINISH_ACTION_NONE'

Finish action: None

Properties

Propertyprotectedstring  $_barIndicatorChar= ''

Indicator character(s) within the bar

Details
Type
string
Propertyprotectedstring  $_barLeftChar= '#'

Left character(s) within the bar

Default value#Details
Type
string
Propertyprotectedstring  $_barRightChar= '-'

Right character(s) within the bar

Default value-Details
Type
string
Propertyprotectedinteger  $_barWidth= ''

Width of the bar element

Details
Type
integer
Propertyprotectedstring  $_charset= 'utf-8'

Charset of text element

Default valueutf-8Details
Type
string
Propertyprotectedarray  $_elements= 'array'

Elements to display

Default valuearrayDetails
Type
array
Propertyprotectedstring  $_finishAction= 'self'

Which action to do at finish call

Default valueselfDetails
Type
string
Propertyprotectedboolean  $_outputStarted= 'false'

Wether the output started yet or not

Default valuefalseDetails
Type
boolean
Propertyprotectedresource  $_outputStream= 'null'

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

Default valuenullDetails
Type
resource
Propertyprotectedstring  $_textWidth= '20'

Width of the text element

Default value20Details
Type
string
Propertyprotectedinteger  $_width= 'null'

Width of the progressbar

Default valuenullDetails
Type
integer

Methods

methodpublic__construct( null|array|\Zend_Config $options = null ) : void

Defined by Zend_ProgressBar_Adapter

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

Parameters
Name Type Description
$options null|array|\Zend_Config
methodpublic__destruct( ) : void

Close local stdout, when open

methodprotected_calculateBarWidth( ) : void

Calculate the bar width when other elements changed

methodprotected_outputData( string $data ) : void

Outputs given data to STDOUT.

This split-off is required for unit-testing.

Parameters
Name Type Description
$data string
methodpublicfinish( ) : void

Defined by Zend_ProgressBar_Adapter_Interface

methodpublicgetOutputStream( ) : resource

Get the current output stream

Returns
Type Description
resource
methodpublicnotify( float $current, float $max, float $percent, integer $timeTaken, integer $timeRemaining, string $text ) : void

Defined by Zend_ProgressBar_Adapter_Interface

Parameters
Name Type Description
$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
methodpublicsetBarIndicatorChar( string $char ) : \Zend_ProgressBar_Adapter_Console

Set the indicator character for the bar

Parameters
Name Type Description
$char string
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
methodpublicsetBarLeftChar( string $char ) : \Zend_ProgressBar_Adapter_Console

Set the left-hand character for the bar

Parameters
Name Type Description
$char string
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
Throws
Exception Description
\Zend_ProgressBar_Adapter_Exception When character is empty
methodpublicsetBarRightChar( string $char ) : \Zend_ProgressBar_Adapter_Console

Set the right-hand character for the bar

Parameters
Name Type Description
$char string
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
Throws
Exception Description
\Zend_ProgressBar_Adapter_Exception When character is empty
methodpublicsetCharset( string $charset ) : void

Set the charset of the text element

Parameters
Name Type Description
$charset string
methodpublicsetConfig( \Zend_Config $config ) : \Zend_ProgressBar_Adapter

Set options via a Zend_Config instance

Inherited from: \Zend_ProgressBar_Adapter::setConfig()
Parameters
Name Type Description
$config \Zend_Config
Returns
Type Description
\Zend_ProgressBar_Adapter
methodpublicsetElements( array $elements ) : \Zend_ProgressBar_Adapter_Console

Set the elements to display with the progressbar

Parameters
Name Type Description
$elements array
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
Throws
Exception Description
\Zend_ProgressBar_Adapter_Exception When an invalid element is foudn in the array
methodpublicsetFinishAction( string $action ) : \Zend_ProgressBar_Adapter_Console

Set the finish action

Parameters
Name Type Description
$action string
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
Throws
Exception Description
\Zend_ProgressBar_Adapter_Exception When an invalid action is specified
methodpublicsetOptions( array $options ) : \Zend_ProgressBar_Adapter

Set options via an array

Inherited from: \Zend_ProgressBar_Adapter::setOptions()
Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_ProgressBar_Adapter
methodpublicsetOutputStream( string $resource ) : \Zend_ProgressBar_Adapter_Console

Set a different output-stream

Parameters
Name Type Description
$resource string
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
methodpublicsetTextWidth( integer $width ) : \Zend_ProgressBar_Adapter_Console

Set the width of the text element

Parameters
Name Type Description
$width integer
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
methodpublicsetWidth( integer $width = null ) : \Zend_ProgressBar_Adapter_Console

Set the width of the progressbar

Parameters
Name Type Description
$width integer
Returns
Type Description
\Zend_ProgressBar_Adapter_Console
Documentation was generated by DocBlox 0.13.3.