Cli::textIndent($text, $spaces);
where:
$text : text to be indented
$spaces : number of indents to be applied
Cli::textView($text, $spacing, $break, $pause);
where:
$text : text to be displayed
$spacing : An optional string format that applies spaces before and after the supplied text using a pipe divider
$break : An optional string format that applies breaks before and after the supplied text using a pipe divider
$pause : An optional string format that applies delays before and after a string is displayed.
Cli::textView("Hello text", 2, 3, 1);
In the code above, the text "Hello text" will be printed on the cli using specific features:
1. The 2
defines that 2 spaces should be applied before the text is printed
2. The 3
defines that 3 line breaks should be added before text is printed
3. The 1
defines a 1 second delay before text is printed.
Cli::textView("Hello text", "2|2", "3|2", '2|1');
The code above reveals that pipes are used to specify the position before and after when an event should be applied.
1. The "2|2"
defines that 2 spaces before and 2 spaces after should be applied on the text
2. The "3|2"
defines that 3 line breaks before and 2 breaks after should be applied on the text
3. The "2|1"
defines that 2 seconds delay before and 1 delay after should be applied on the text.
List
method is used to display an array of strings with numbers. The numbering starts from
zero upward. However, associative arrays will use ther specific array keys
Cli::list($array, $spacing, $break, $interval);
where:
$array : array of strings to be displayed
$spacing : An optional spacing format that applies spacing on each text to be displayed
$break : An optional line breaking format that applies spacing on each text to be displayed
$interval : An optional delay format that applies delay in seconds on each text to be displayed
Cli::List(['Foo','Bar', 'Baz'], 0, "|1");
The response will be as below:
1. Foo
2. Bar
3. Baz
Cli::List(['a'=>'Foo','b'=>'Bar', 'c' => 'Baz'], 0, "|1");
The response will be as below:
a. Foo
b. Bar
c. Baz
Cli::dots($max, $text, $char);
where:
$max : The expected length of text characters that must be generated.
$text : A given text whose length of characters is measured
$char : A character that fills up left over space. Default is dots "."
backspace()
method is used to delete the text characters starting from the right towards the
left side.
Cli::backspace($times);
where: $times is the number of times a backspace must be applied. The default value is "1".
cls()
method is used to clear the terminal screen.
clearLine()
method is used to delete the entire character on a line. This method takes
no arguments.
Cli::backspace($times);
where: $times is the number of times a backspace must be applied. The default value is "1".
clearUp()
method is used to delete a line before a text is printed. It shifts the positon of the cli pointer
up by deleting all characters found along the way to its destination point.
Cli::clearUp($times);
where: $times is the number of times a the pointer must move up. The default value is "1".
upLine()
method is used to shift the position of the command line pointer upwards without
deleting any character.
Cli::upLine($times);
where: $times is the number of times a cursor must be shifted upwards.
br()
method is used to apply text line breaks after a text has been printed.
Cli::br($times);
where: $times is the number of times a line break must be applied. Default value is "1".
break()
method is also used to apply text line breaks after a text has been printed. The difference between Cli::br()
and Cli::break()
is that the latter prints directly by default while the former returns line breaks. However, the Cli::break()
can also be modified to return line breaks rather than printing them. This can be done by setting the second argument to false.
Cli::break($times, $print);
where:
$times : The number of times a line break must be applied. Default value is "1".
$print : When set as false, line breaks will only be returned as a string