Zeta Components Manual :: Docs For Class ezcConsoleStatusbar
ConsoleTools::ezcConsoleStatusbar
Class ezcConsoleStatusbar
Creating and maintaining status-bars to be printed to the console.
- // Construction
- // Set option
- $status->options['successChar'] = '*';
- // Run statusbar
- foreach ( $files as $file )
- {
- $res = $file->upload();
- // Add status if form of bool true/false to statusbar.
- }
- // Retreive and display final statusbar results
- $msg = $status->getSuccess() . ' succeeded, ' . $status->getFailure() . ' failed.';
- $out->outputText( "Finished uploading files: $msg\n" );
Source for this file: /ConsoleTools/src/statusbar.php
Version: | //autogen// |
Properties
ezcConsoleStatusbarOptions | read/write |
$options
Contains the options for this class. |
Member Variables
protected array(bool=>int) |
$counter
= array(
Counter for success and failure outputs. |
protected ezcConsoleOutput |
$outputHandler
The ezcConsoleOutput object to use. |
protected array(string=>mixed) |
$properties
Container to hold the properties |
Method Summary
public ezcConsoleStatusbar |
__construct(
$outHandler
, [ $options
= array()] )
Creates a new status bar. |
public void |
add(
$status
)
Add a status to the status bar. |
public int |
getFailureCount(
)
Returns number of failures during the run. |
public ezcConsoleStatusbarOptions |
getOptions(
)
Returns the current options. |
public int |
getSuccessCount(
)
Returns number of successes during the run. |
public void |
reset(
)
Reset the state of the status-bar object to its initial one. |
public void |
setOptions(
$options
)
Set new options. |
Methods
__construct
Creates a new status bar.
Parameters:
Name | Type | Description |
---|---|---|
$outHandler |
ezcConsoleOutput | Handler to utilize for output |
$options |
array(string=>string) | Options |
add
Add a status to the status bar.
Adds a new status to the bar which is printed immediately. If the cursor is currently not at the beginning of a line, it will move to the next line.
Parameters:
Name | Type | Description |
---|---|---|
$status |
bool | Print successChar on true, failureChar on false. |
getFailureCount
Returns number of failures during the run.
Returns the number of failure characters printed from this status bar.
getOptions
Returns the current options.
Returns the options currently set for this progressbar.
getSuccessCount
Returns number of successes during the run.
Returns the number of success characters printed from this status bar.
reset
Reset the state of the status-bar object to its initial one.
setOptions
Set new options.
This method allows you to change the options of a statusbar.
Parameters:
Name | Type | Description |
---|---|---|
$options |
array(string=>string)|ezcConsoleOutputOptions | The options to set. |
Exceptions:
Type | Description |
---|---|
ezcBaseSettingNotFoundException |
If you tried to set a non-existent option value. |
ezcBaseSettingValueException |
If the value is not valid for the desired option. |
ezcBaseValueException |
If you submit neither an array nor an instance of ezcConsoleOutputOptions. |