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

Public Member Functions

 __construct (string $content)
 
 setTopLeftCorner (string $char)
 
 setBottomLeftCorner (string $char)
 
 setTopRightCorner (string $char)
 
 setBottomRightCorner (string $char)
 
 setHLine (string $char)
 
 setVLine (string $char)
 
 setHAlign (HAlign $halign)
 
 draw ()
 
- Public Member Functions inherited from DrawableInterface

Protected Attributes

string $topLeftCornerChar = '+'
 
string $bottomLeftCornerChar = '+'
 
string $topRightCornerChar = '+'
 
string $bottomRightCornerChar = '+'
 
string $horizontalBorderChar = '-'
 
string $verticalBorderChar = '|'
 
HAlign $horizontalAlign
 
readonly string $content
 

Detailed Description

Draws a box with text.

Author
everton3x @SuppressWarnings(PHPMD.LongVariable)

Definition at line 15 of file Box.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string $content)

Definition at line 26 of file Box.php.

Member Function Documentation

◆ draw()

draw ( )

Displays the box on the screen.

Returns
void @SuppressWarnings(PHPMD.StaticAccess)

Implements DrawableInterface.

Definition at line 153 of file Box.php.

◆ setBottomLeftCorner()

setBottomLeftCorner ( string $char)

Sets a single character to be displayed in the lower left corner of the box. The default is +.

Parameters
string$char
Returns
Box
Exceptions
InvalidArgumentException

Definition at line 57 of file Box.php.

◆ setBottomRightCorner()

setBottomRightCorner ( string $char)

Sets a single character to be displayed in the lower right corner of the box. The default is +.

Parameters
string$char
Returns
Box
Exceptions
InvalidArgumentException

Definition at line 91 of file Box.php.

◆ setHAlign()

setHAlign ( HAlign $halign)

Set the horizontal alignment of the text (centered, left, or right). The default is centered.

Parameters
HAlign$halign
Returns
Box

Definition at line 141 of file Box.php.

◆ setHLine()

setHLine ( string $char)

Sets a single character to be used as the vertical border of the box. The default is -.

Parameters
string$char
Returns
Box
Exceptions
InvalidArgumentException

Definition at line 108 of file Box.php.

◆ setTopLeftCorner()

setTopLeftCorner ( string $char)

Sets a single character to be displayed in the upper left corner of the box. The default is +.

Parameters
string$char
Returns
Box
Exceptions
InvalidArgumentException

Definition at line 40 of file Box.php.

◆ setTopRightCorner()

setTopRightCorner ( string $char)

Sets a single character to be displayed in the upper right corner of the box. The default is +.

Parameters
string$char
Returns
Box
Exceptions
InvalidArgumentException

Definition at line 74 of file Box.php.

◆ setVLine()

setVLine ( string $char)

Sets a single character to be used as the vertical border of the box. The default is -.

Parameters
string$char
Returns
Box
Exceptions
InvalidArgumentException

Definition at line 125 of file Box.php.

Field Documentation

◆ $bottomLeftCornerChar

string $bottomLeftCornerChar = '+'
protected

Definition at line 18 of file Box.php.

◆ $bottomRightCornerChar

string $bottomRightCornerChar = '+'
protected

Definition at line 20 of file Box.php.

◆ $content

readonly string $content
protected

Definition at line 24 of file Box.php.

◆ $horizontalAlign

HAlign $horizontalAlign
protected

Definition at line 23 of file Box.php.

◆ $horizontalBorderChar

string $horizontalBorderChar = '-'
protected

Definition at line 21 of file Box.php.

◆ $topLeftCornerChar

string $topLeftCornerChar = '+'
protected

Definition at line 17 of file Box.php.

◆ $topRightCornerChar

string $topRightCornerChar = '+'
protected

Definition at line 19 of file Box.php.

◆ $verticalBorderChar

string $verticalBorderChar = '|'
protected

Definition at line 22 of file Box.php.


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