CliOutputController
extends OutputController
in package
Output controller for cli output
Tags
Table of Contents
Constants
- AFTER_VALUE = ' '
- BEFORE_VALUE = ' '
- BOTTOM = '-'
- BOTTOM_CORNER = '+'
- BOTTOM_LEFT_CORNER = '+'
- BOTTOM_RIGHT_CORNER = '+'
- LEFT = '|'
- LEFT_CORNER = '+'
- LINE_END = "\n"
- MIDDLE_CORNER = '+'
- MIDDLE_HORIZONTAL = '-'
- MIDDLE_VERTICAL = '|'
- PAD = ' '
- RIGHT = '|'
- RIGHT_CORNER = '+'
- TOP = '-'
- TOP_CORNER = '+'
- TOP_LEFT_CORNER = '+'
- TOP_RIGHT_CORNER = '+'
Properties
Methods
- __call() : mixed
- Route methods like getName(), getType(), getDirectory(), etc.
- __construct() : mixed
- Creates new controller
- getSystemComponentController() : SystemComponentController
- Returns the main controller
- parse() : string
- Returns the cli encoded (/unencoded) data
- array_depth() : int
- Detects the depth of an array
- createTableBorderLine() : string
- Creates one of the border lines (those without data)
- createTableDataLine() : string
- Creates one of the data lines
- createTableLine() : mixed
- Creates a table line using the supplied signs
- tablify() : string
- Creates a human readable table with ASCII art
Constants
AFTER_VALUE
public
Character
AFTER_VALUE
= ' '
after each value
BEFORE_VALUE
public
Character
BEFORE_VALUE
= ' '
before each value
BOTTOM
public
Character
BOTTOM
= '-'
for bottom line
BOTTOM_CORNER
public
Character
BOTTOM_CORNER
= '+'
for bottom corners
BOTTOM_LEFT_CORNER
public
Character
BOTTOM_LEFT_CORNER
= '+'
for bottom left corner
BOTTOM_RIGHT_CORNER
public
Character
BOTTOM_RIGHT_CORNER
= '+'
for bottom right corner
LEFT
public
Character
LEFT
= '|'
for left line
LEFT_CORNER
public
Character
LEFT_CORNER
= '+'
for left corners
LINE_END
public
Character
LINE_END
= "\n"
for line break
MIDDLE_CORNER
public
Character
MIDDLE_CORNER
= '+'
for line crossings
MIDDLE_HORIZONTAL
public
Character
MIDDLE_HORIZONTAL
= '-'
for middle horizontal lines
MIDDLE_VERTICAL
public
Character
MIDDLE_VERTICAL
= '|'
for middle vertical lines
PAD
public
Character
PAD
= ' '
to pad smaller values
RIGHT
public
Character
RIGHT
= '|'
for right line
RIGHT_CORNER
public
Character
RIGHT_CORNER
= '+'
for right corners
TOP
public
Character
TOP
= '-'
for top line
TOP_CORNER
public
Character
TOP_CORNER
= '+'
for top corners
TOP_LEFT_CORNER
public
Character
TOP_LEFT_CORNER
= '+'
for top left corner
TOP_RIGHT_CORNER
public
Character
TOP_RIGHT_CORNER
= '+'
for right left corner
Properties
$cx
Main class instance
protected
Cx
$cx
= null
Methods
__call()
Route methods like getName(), getType(), getDirectory(), etc.
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
- $methodName : string
-
Name of method to call
- $arguments : array<string|int, mixed>
-
List of arguments for the method to call
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Return value of the method to call
__construct()
Creates new controller
public
__construct(SystemComponentController $systemComponentController, Cx $cx) : mixed
Parameters
- $systemComponentController : SystemComponentController
-
Main controller for this system component
- $cx : Cx
-
Main class instance
getSystemComponentController()
Returns the main controller
public
getSystemComponentController() : SystemComponentController
Return values
SystemComponentController —Main controller for this system component
parse()
Returns the cli encoded (/unencoded) data
public
parse(array<string|int, mixed> $data) : string
Parameters
- $data : array<string|int, mixed>
-
Data to encode
Return values
string —Encoded data
array_depth()
Detects the depth of an array
protected
array_depth(array<string|int, mixed> $array) : int
Parameters
- $array : array<string|int, mixed>
-
Array to analyze
Return values
int —Depth of $array
createTableBorderLine()
Creates one of the border lines (those without data)
protected
createTableBorderLine(array<string|int, mixed> $fieldLength, string $position) : string
Parameters
- $fieldLength : array<string|int, mixed>
-
List of the size of the longest values for each attribute
- $position : string
-
Either 'top', 'middle' or 'bottom'
Return values
string —One table line without data
createTableDataLine()
Creates one of the data lines
protected
createTableDataLine(array<string|int, mixed> $fieldLength, array<string|int, mixed> $data) : string
Parameters
- $fieldLength : array<string|int, mixed>
-
List of the size of the longest values for each attribute
- $data : array<string|int, mixed>
-
Data for this row
Return values
string —One table line with data
createTableLine()
Creates a table line using the supplied signs
protected
createTableLine(string $begin, string $beforeValue, string $filler, string $afterValue, string $corner, string $end, mixed $lengths, array<string|int, mixed> $data) : mixed
Parameters
- $begin : string
-
Character to begin the line with (must be of same length for each row!)
- $beforeValue : string
-
Character to insert before value (must be of same length for each row!)
- $filler : string
-
Padding character for smaller values (must be just one character!)
- $afterValue : string
-
Character to insert after value (must be of same length for each row!)
- $corner : string
-
Character to separate values (must be of same length for each row!)
- $end : string
-
Character to end the line with (must be of same length for each row!)
- $lengths : mixed
- $data : array<string|int, mixed>
-
Data for this row
tablify()
Creates a human readable table with ASCII art
protected
tablify(mixed $table) : string
Parameters
- $table : mixed
Tags
Return values
string —ASCII art table