ProgressBar/Adapter/Console.php

Show: PublicProtectedPrivateinherited
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 [email protected] so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_ProgressBar  
Version
$Id$  

\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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
 

Constants

>VConstant  ELEMENT_PERCENT = 'ELEMENT_PERCENT'
Percentage value of the progress
>VConstant  ELEMENT_BAR = 'ELEMENT_BAR'
Visual value of the progress
>VConstant  ELEMENT_ETA = 'ELEMENT_ETA'
ETA of the progress
>VConstant  ELEMENT_TEXT = 'ELEMENT_TEXT'
Text part of the progress
>VConstant  FINISH_ACTION_EOL = 'FINISH_ACTION_EOL'
Finish action: End of Line
>VConstant  FINISH_ACTION_CLEAR_LINE = 'FINISH_ACTION_CLEAR_LINE'
Finish action: Clear Line
>VConstant  FINISH_ACTION_NONE = 'FINISH_ACTION_NONE'
Finish action: None

Properties

>VPropertyprotectedstring $_barIndicatorChar = ''
Indicator character(s) within the bar
Default value''Details
Type
string
>VPropertyprotectedstring $_barLeftChar = '#'
Left character(s) within the bar
Default value'#'Details
Type
string
>VPropertyprotectedstring $_barRightChar = '-'
Right character(s) within the bar
Default value'-'Details
Type
string
>VPropertyprotectedinteger $_barWidth
Width of the bar element
Details
Type
integer
>VPropertyprotectedstring $_charset = 'utf-8'
Charset of text element
Default value'utf-8'Details
Type
string
>VPropertyprotectedarray $_elements = array(self::ELEMENT_PERCENT, self::ELEMENT_BAR, self::ELEMENT_ETA)
Elements to display
Default valuearray(self::ELEMENT_PERCENT, self::ELEMENT_BAR, self::ELEMENT_ETA)Details
Type
array
>VPropertyprotectedstring $_finishAction = self::FINISH_ACTION_EOL
Which action to do at finish call
Default valueself::FINISH_ACTION_EOLDetails
Type
string
>VPropertyprotectedboolean $_outputStarted = false
Wether the output started yet or not
Default valuefalseDetails
Type
boolean
>VPropertyprotectedresource $_outputStream = null
Output-stream, when STDOUT is not defined (e.g. in CGI) or set manually
Default valuenullDetails
Type
resource
>VPropertyprotectedstring $_textWidth = 20
Width of the text element
Default value20Details
Type
string
>VPropertyprotectedinteger $_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
NameTypeDescription
$optionsnull | 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
NameTypeDescription
$datastring
methodpublicfinish() : void

Defined by Zend_ProgressBar_Adapter_Interface

methodpublicgetOutputStream() : resource

Get the current output stream

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

Defined by Zend_ProgressBar_Adapter_Interface

Parameters
NameTypeDescription
$currentfloat

Current progress value

$maxfloat

Max progress value

$percentfloat

Current percent value

$timeTakeninteger

Taken time in seconds

$timeRemaininginteger

Remaining time in seconds

$textstring

Status text

methodpublicsetBarIndicatorChar(string $char) : \Zend_ProgressBar_Adapter_Console

Set the indicator character for the bar

Parameters
NameTypeDescription
$charstring
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
methodpublicsetBarLeftChar(string $char) : \Zend_ProgressBar_Adapter_Console

Set the left-hand character for the bar

Parameters
NameTypeDescription
$charstring
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
Throws
ExceptionDescription
\Zend_ProgressBar_Adapter_ExceptionWhen character is empty
methodpublicsetBarRightChar(string $char) : \Zend_ProgressBar_Adapter_Console

Set the right-hand character for the bar

Parameters
NameTypeDescription
$charstring
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
Throws
ExceptionDescription
\Zend_ProgressBar_Adapter_ExceptionWhen character is empty
methodpublicsetCharset(string $charset) : void

Set the charset of the text element

Parameters
NameTypeDescription
$charsetstring
methodpublicsetElements(array $elements) : \Zend_ProgressBar_Adapter_Console

Set the elements to display with the progressbar

Parameters
NameTypeDescription
$elementsarray
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
Throws
ExceptionDescription
\Zend_ProgressBar_Adapter_ExceptionWhen an invalid element is foudn in the array
methodpublicsetFinishAction(string $action) : \Zend_ProgressBar_Adapter_Console

Set the finish action

Parameters
NameTypeDescription
$actionstring
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
Throws
ExceptionDescription
\Zend_ProgressBar_Adapter_ExceptionWhen an invalid action is specified
methodpublicsetOutputStream(string $resource) : \Zend_ProgressBar_Adapter_Console

Set a different output-stream

Parameters
NameTypeDescription
$resourcestring
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
methodpublicsetTextWidth(integer $width) : \Zend_ProgressBar_Adapter_Console

Set the width of the text element

Parameters
NameTypeDescription
$widthinteger
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
methodpublicsetWidth(integer $width = null) : \Zend_ProgressBar_Adapter_Console

Set the width of the progressbar

Parameters
NameTypeDescription
$widthinteger
Returns
TypeDescription
\Zend_ProgressBar_Adapter_Console
Documentation was generated by phpDocumentor 2.2.0 .