PHP Класс ProgressBar\Manager

Автор: guiguiboy
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$format Default format for the progress bar
$registry Instance of Registry. Used to store metrics.
$replacementRules array Stores replacement rules

Открытые методы

Метод Описание
__construct ( $current, $max, $width = 80, $doneBarElementCharacter = '=', $remainingBarElementCharacter = '-', $currentPositionCharacter = '>' ) Class constructor
addReplacementRule ( string $tag, integer $priority, callable $callable ) Register a replacement rule
advance ( ) Advances the progress bar with one step.
getFormat ( ) : string Returns the current output format
getRegistry ( ) : Registry Returns the Registry
setFormat ( string $string ) Sette le format d'affichage
setRegistry ( Registry $registry ) Sets a Registry
update ( integer $current ) Updates current progress Saves new metrics in the registry

Защищенные методы

Метод Описание
clearRightCharacters ( string $buffer ) : string Clears line remaining characters so that buffer length always equals to max width.
display ( boolean $lineReturn ) Prints the progress bar
registerDefaultReplacementRules ( ) Allows to define replacements functions for the format string If you wish to add custom replacements rules, extend this class, and add overload this method.

Описание методов

__construct() публичный Метод

Class constructor
public __construct ( $current, $max, $width = 80, $doneBarElementCharacter = '=', $remainingBarElementCharacter = '-', $currentPositionCharacter = '>' )

addReplacementRule() публичный Метод

Register a replacement rule
public addReplacementRule ( string $tag, integer $priority, callable $callable )
$tag string
$priority integer
$callable callable

advance() публичный Метод

Advances the progress bar with one step.
public advance ( )

clearRightCharacters() защищенный Метод

registry->getValue('width') -1 stands for the control character \r or \n that will be added to the buffer.
protected clearRightCharacters ( string $buffer ) : string
$buffer string
Результат string

display() защищенный Метод

Prints the progress bar
protected display ( boolean $lineReturn )
$lineReturn boolean

getFormat() публичный Метод

Returns the current output format
public getFormat ( ) : string
Результат string

getRegistry() публичный Метод

Returns the Registry
public getRegistry ( ) : Registry
Результат Registry

registerDefaultReplacementRules() защищенный Метод

Each replacement has a priority and a closure

setFormat() публичный Метод

Sette le format d'affichage
public setFormat ( string $string )
$string string

setRegistry() публичный Метод

Sets a Registry
public setRegistry ( Registry $registry )
$registry Registry

update() публичный Метод

Updates current progress Saves new metrics in the registry
public update ( integer $current )
$current integer

Описание свойств

$format защищенное свойство

Default format for the progress bar
protected $format

$registry защищенное свойство

Instance of Registry. Used to store metrics.
protected $registry

$replacementRules защищенное свойство

Stores replacement rules
protected array $replacementRules
Результат array