PHP 클래스 ProgressBar\Manager

저자: guiguiboy
파일 보기 프로젝트 열기: guiguiboy/php-cli-progress-bar 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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