Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcConsoleProgressMonitor

ConsoleTools::ezcConsoleProgressMonitor

Class ezcConsoleProgressMonitor

Printing structured status information on the console.

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

Source for this file: /ConsoleTools/src/progressmonitor.php

Version:   //autogen//

Properties

ezcConsoleProgressMonitorOptions read/write $options
Contains the options for this class.

Member Variables

protected int $counter = 0
Counter for the items already printed.
protected int $max
The number of entries to expect.
protected ezcConsoleProgressMonitorOptions $options
Options
protected ezcConsoleOutput $outputHandler
The ezcConsoleOutput object to use.

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.

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

void setOptions( ezcConsoleProgressMonitorOptions $options )

Set new options.

This method allows you to change the options of an progress monitor.

Parameters:
Name Type Description
$options ezcConsoleProgressMonitorOptions 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 ezcConsoleProgressMonitorOptions.

__get

mixed __get( string $key )

Property read access.

Parameters:
Name Type Description
$key string Name of the property.
Exceptions:
Type 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.
Exceptions:
Type Description
ezcBaseValueException If a the value for the property options is not an instance of ezcConsoleProgressMonitorOptions.
Documentation generated by phpDocumentor 1.4.3