class AbstractCliApplication extends AbstractApplication (View source)

Simple class for a Windwalker command line application.

Methods

__construct(IOInterface $io = null, Structure $config = null)

Class constructor.

void
close(integer|string $message)

Method to close the application.

mixed
execute()

Execute the application.

mixed
get(string $key, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

LoggerInterface
getLogger()

Get the logger.

mixed
set(string $key, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

setConfiguration(Structure $config)

Sets the configuration for the application.

setLogger(LoggerInterface $logger)

Set the logger.

mixed
__get($name)

is utilized for reading data from inaccessible members.

out(string $text = '', boolean $nl = true)

Write a string to standard output.

string
in()

Get a value from standard input.

getIO()

Get the IO object.

setIO(IOInterface $io)

Set the IO object.

Details

at line line 43
__construct(IOInterface $io = null, Structure $config = null)

Class constructor.

Parameters

IOInterface $io An optional argument to provide dependency injection for the application's IO object.
Structure $config An optional argument to provide a Structure object to be config.

void close(integer|string $message)

Method to close the application.

Parameters

integer|string $message The exit code (optional; default is 0).

Return Value

void

mixed execute()

Execute the application.

Return Value

mixed

mixed get(string $key, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $key The name of the property.
mixed $default The default value (optional) if none is set.

Return Value

mixed The value of the configuration.

LoggerInterface getLogger()

Get the logger.

Return Value

LoggerInterface

mixed set(string $key, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $key The name of the property.
mixed $value The value of the property to set (optional).

Return Value

mixed Previous value of the property

AbstractApplication setConfiguration(Structure $config)

Sets the configuration for the application.

Parameters

Structure $config A structure object holding the configuration.

Return Value

AbstractApplication Returns itself to support chaining.

AbstractApplication setLogger(LoggerInterface $logger)

Set the logger.

Parameters

LoggerInterface $logger The logger.

Return Value

AbstractApplication Returns itself to support chaining.

at line line 124
mixed __get($name)

is utilized for reading data from inaccessible members.

Parameters

$name string

Return Value

mixed

at line line 74
AbstractCliApplication out(string $text = '', boolean $nl = true)

Write a string to standard output.

Parameters

string $text The text to display.
boolean $nl True (default) to append a new line at the end of the output string.

Return Value

AbstractCliApplication Instance of $this to allow chaining.

at line line 88
string in()

Get a value from standard input.

Return Value

string The input string from standard input.

at line line 98
IOInterface getIO()

Get the IO object.

Return Value

IOInterface

at line line 110
AbstractCliApplication setIO(IOInterface $io)

Set the IO object.

Parameters

IOInterface $io The IO object.

Return Value

AbstractCliApplication Return self to support chaining.