API Documentation

Zend/ProgressBar/Adapter/Console.php

Show: inherited
Table of Contents

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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_ProgressBar  
Version
$Id: Console.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_ProgressBar_Adapter_Console

Package: Zend\ProgressBar

Zend_ProgressBar_Adapter_Console offers a text-based progressbar for console applications

Parent(s)
\Zend_ProgressBar_Adapter
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
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

Default value''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 value'utf-8'Details
Type
string
Propertyprotectedarray  $_elements= 'array(self::ELEMENT_PERCENT'

Elements to display

Default valuearray(self::ELEMENT_PERCENTDetails
Type
array
Propertyprotectedstring  $_finishAction= 'self::FINISH_ACTION_EOL'

Which action to do at finish call

Default valueself::FINISH_ACTION_EOLDetails
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

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
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
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.15.1.