ConsoleTools: ezcConsoleProgressMonitor
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcConsoleProgressMonitor
|
Printing structured status information on the console. [
source]
1. // Construction
2. $status = new ezcConsoleProgressMonitor( new ezcConsoleOutput(), 42 );
3.
4. // Run statusbar
5. foreach ( $files as $file )
6. {
7. $res = $file->upload();
8. // Add a status-entry to be printed.
9. $status->addEntry( 'UPLOAD', $file->path );
10. // Result like " 2.5% UPLOAD /var/upload/test.png"
11. }
Properties
Member Variables
Method Summary
|
public ezcConsoleProgressMonitor |
__construct(
$outHandler, $max, [$options = array()] )
Creates a new progress monitor. |
|
public void |
addEntry(
$tag, $data )
Print a status entry. |
|
public ezcConsoleProgressMonitorOptions |
getOptions(
)
Returns the currently set options. |
|
public void |
setOptions(
$options )
Set new options. |
|
public mixed |
__get(
$key )
Property read access. |
|
public bool |
__isset(
$propertyName )
Property isset access. |
|
public void |
__set(
$propertyName, $val )
Property write access. |
Methods
__construct
ezcConsoleProgressMonitor __construct(
ezcConsoleOutput
$outHandler, int
$max, [
$options = array()] )
Creates a new progress monitor.
The $outputHandler parameter will be used to display the progress monitor. $max is the number of monitor items to expect. $options can be used to define the behaviour of the monitor
ezcConsoleProgressMonitorOptions.
Parameters
| Name |
Type |
Description |
$outHandler |
ezcConsoleOutput |
Handler to utilize for output |
$max |
int |
Number of items to expect |
$options |
array(string=>string) |
Options. |
See also:
ezcConsoleProgressMonitor::$options.
addEntry
void addEntry(
string
$tag, string
$data )
Print a status entry.
Prints a new status entry to the console and updates the internal counter.
Parameters
| Name |
Type |
Description |
$tag |
string |
The tag to print (second argument in the formatString). |
$data |
string |
The data to be printed in the status entry (third argument in the format string). |
getOptions
Returns the currently set options.
Returns the currently set option array.
setOptions
Set new options.
This method allows you to change the options of an progress monitor.
Parameters
Throws
| Class | 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 ezcConsoleProgressMonitorOptions. |
__get
mixed __get(
string
$key )
Property read access.
Parameters
| Name |
Type |
Description |
$key |
string |
Name of the property. |
Throws
| Class | Description |
ezcBasePropertyNotFoundException |
If the the desired property is not found. |
__isset
bool __isset(
string
$propertyName )
Property isset access.
Parameters
| Name |
Type |
Description |
$propertyName |
string |
Name of the property. |
__set
void __set(
string
$propertyName, mixed
$val )
Property write access.
Parameters
| Name |
Type |
Description |
$propertyName |
string |
Name of the property. |
$val |
mixed |
The value for the property. |
Throws
| Class | Description |
ezcBaseValueException |
If a the value for the property options is not an instance of ezcConsoleProgressMonitorOptions. |
Last updated: Thu, 31 Jan 2008