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

Public Member Functions

 __construct (string $label)
 
 read ()
 
- Public Member Functions inherited from EntryInterface

Protected Attributes

readonly string $label
 

Detailed Description

User text input.

Displays a message to the user and returns the text the user entered. When the user presses ENTER, the raw text entered is fed to the trim() function and returned.

The label is displayed on the same line as the entry point. This means that if you want to display the label above the input space, add a line break at the end of $label. The same goes for whitespace and tabs.

Author
everton3x

Definition at line 18 of file TextEntry.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string $label)

Definition at line 22 of file TextEntry.php.

Member Function Documentation

◆ read()

read ( )

Displays the label and waits for user input.

Returns
string Returns the text entered by the user as processed by trim().

Implements EntryInterface.

Definition at line 32 of file TextEntry.php.

Field Documentation

◆ $label

readonly string $label
protected

Definition at line 20 of file TextEntry.php.


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