Text UI
A simple and fast way to take user input and display output in text mode using PHP.
Loading...
Searching...
No Matches
Loader Class Reference
Inheritance diagram for Loader:
MeterInterface

Public Member Functions

 __construct ()
 
 setLabel (string $label)
 
 init (string $label)
 
 update ()
 
 end (string $indicator='Ok')
 

Protected Member Functions

 padLabel (string $label, int $indicatorWidth)
 

Protected Attributes

string $label = ''
 
array $indicators
 
int $currentIndicatorIndex = 0
 

Detailed Description

Loader and dynamic labels to indicate that a particular task is running.

Author
everton3x @SuppressWarnings(PHPMD.LongVariable)

Definition at line 14 of file Loader.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 45 of file Loader.php.

Member Function Documentation

◆ end()

end ( string $indicator = 'Ok')

Indicates task completion by displaying a custom indicator. Defaults is "Ok".

Parameters
string$indicator
Returns
void @SuppressWarnings(PHPMD.StaticAccess)

Definition at line 119 of file Loader.php.

◆ init()

init ( string $label)

Starts the loader with an initial label that can be changed during task execution with Loader::setLabel().

Parameters
string$label
Returns
void

Definition at line 68 of file Loader.php.

◆ padLabel()

padLabel ( string $label,
int $indicatorWidth )
protected
Parameters
string$label
int$indicatorWidth
Returns
string @SuppressWarnings(PHPMD.StaticAccess)

Definition at line 105 of file Loader.php.

◆ setLabel()

setLabel ( string $label)

Sets a label for the task.

Parameters
string$label
Returns
Loader

Definition at line 55 of file Loader.php.

◆ update()

update ( )

Updates the task, changing the loader and label.

Returns
void @SuppressWarnings(PHPMD.StaticAccess)

Definition at line 80 of file Loader.php.

Field Documentation

◆ $currentIndicatorIndex

int $currentIndicatorIndex = 0
protected

Definition at line 43 of file Loader.php.

◆ $indicators

array $indicators
protected
Initial value:
= [
' ',
' .',
' . ',
' . ',
'. ',
'. .',
'. . ',
'.. ',
'.. .',
'... ',
'....',
'... ',
'.. .',
'.. ',
'. . ',
'. .',
'. ',
' . ',
' . ',
' .'
]

Definition at line 21 of file Loader.php.

◆ $label

string $label = ''
protected

Definition at line 16 of file Loader.php.


The documentation for this class was generated from the following file: