Phpcraft
Public Member Functions | Public Attributes | List of all members
Phpcraft\FancyUserInterface Class Reference
Inheritance diagram for Phpcraft\FancyUserInterface:
Inheritance graph
[legend]
Collaboration diagram for Phpcraft\FancyUserInterface:
Collaboration graph
[legend]

Public Member Functions

 __construct (string $title)
 
 add (string $message)
 
 render ()
 
 setInputPrefix (string $input_prefix)
 
 append (string $appendix)
 
- Public Member Functions inherited from Phpcraft\UserInterface
 __construct ($title=null)
 

Public Attributes

 $tabcomplete_function = null
 

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\FancyUserInterface::__construct ( string  $title)

Note that from this point forward, STDIN and STDOUT are in the hands of the UI with no way out. Make sure to register a "stdin_line" event handler with pas if you'd like input to work. A render loop will be registered with pas, but you may still call ::render if you need immediate rendering. For PHP <7.2.0 and Windows <10.0.10586, use the PlainUserInterface.

Parameters
string$titleThe title that the terminal window will be given.

Member Function Documentation

◆ add()

Phpcraft\FancyUserInterface::add ( string  $message)

Adds a message to be printed on the user interface.

Parameters
string$message
Returns
FancyUserInterface $this

Reimplemented from Phpcraft\UserInterface.

◆ append()

Phpcraft\FancyUserInterface::append ( string  $appendix)

Appends to the last message.

Parameters
string$appendix
Returns
FancyUserInterface $this

Reimplemented from Phpcraft\UserInterface.

◆ render()

Phpcraft\FancyUserInterface::render ( )

Renders the UI immediately.

Reimplemented from Phpcraft\UserInterface.

◆ setInputPrefix()

Phpcraft\FancyUserInterface::setInputPrefix ( string  $input_prefix)

Sets the string displayed before the user's input

Parameters
string$input_prefix
Returns
void

Member Data Documentation

◆ $tabcomplete_function

callable Phpcraft\FancyUserInterface::$tabcomplete_function = null

The function called when the user presses the tabulator key with the currently selected word as parameter. The return should be an array of possible completions.