class AbstractConsole (View source)

The AbstractConsole class.

Properties

IOInterface $io Property io.

Methods

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

Class constructor.

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

Write a string to standard output.

string
in()

Get a value from standard input.

getIO()

getIo

void
close(integer|string $message)

Method to close the application.

void
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.

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.

getConfig()

Method to get property Config

setConfig(Structure $config)

Method to set property config

setDescriptor(DescriptorHelperInterface $descriptor)

Method to set property descriptor

string
describeCommand(AbstractCommand $command)

describeCommand

Details

at line line 57
__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 dependency injection for the config object.

at line line 88
AbstractConsole 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

AbstractConsole Instance of $this to allow chaining.

at line line 102
string in()

Get a value from standard input.

Return Value

string The input string from standard input.

at line line 112
IOInterface getIO()

getIo

Return Value

IOInterface

at line line 124
AbstractConsole setIO(IOInterface $io)

setIo

Parameters

IOInterface $io

Return Value

AbstractConsole Return self to support chaining.

at line line 140
void close(integer|string $message)

Method to close the application.

Parameters

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

Return Value

void

at line line 164
void execute()

Execute the application.

Return Value

void

at line line 209
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.

at line line 238
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

at line line 254
AbstractConsole setConfiguration(Structure $config)

Sets the configuration for the application.

Parameters

Structure $config A structure object holding the configuration.

Return Value

AbstractConsole Returns itself to support chaining.

at line line 266
Structure getConfig()

Method to get property Config

Return Value

Structure

at line line 278
AbstractConsole setConfig(Structure $config)

Method to set property config

Parameters

Structure $config

Return Value

AbstractConsole Return self to support chaining.

at line line 292
DescriptorHelperInterface|TextDescriptorHelper getDescriptor()

Get or create descriptor.

at line line 312
AbstractConsole setDescriptor(DescriptorHelperInterface $descriptor)

Method to set property descriptor

Parameters

DescriptorHelperInterface $descriptor

Return Value

AbstractConsole Return self to support chaining.

at line line 326
string describeCommand(AbstractCommand $command)

describeCommand

Parameters

AbstractCommand $command

Return Value

string