PHP Class ConsoleKit\Console

Inheritance: implements consolekit\TextWriter
Afficher le fichier Open project: maximebf/consolekit Class Usage Examples

Protected Properties

Свойство Type Description
$commands array
$defaultCommand string
$exitOnException boolean
$helpCommand string
$helpCommandClass string
$optionsParser consolekit\OptionsParser
$singleCommand boolean
$textWriter consolekit\TextWriter
$verboseException boolean

Méthodes publiques

Méthode Description
__construct ( array $commands = [], consolekit\OptionsParser $parser = null, consolekit\TextWriter $writer = null )
addCommand ( callback $callback, string $alias = null, boolean $default = false ) : Console Registers a command
addCommands ( array $commands ) : Console Adds multiple commands at once
addCommandsFromDir ( string $dir, string $namespace = '', boolean $includeFiles = false ) : Console Registers commands from a directory
areExceptionsVerbose ( ) : boolean
execute ( string $command = null, array $args = [], array $options = [] ) : mixed Executes a command
exitsOnException ( ) : boolean
getCommand ( string $name ) : string
getCommands ( ) : array
getDefaultCommand ( ) : string
getOptionsParser ( ) : consolekit\OptionsParser
getTextWriter ( ) : consolekit\TextWriter
hasCommand ( string $name ) : boolean
run ( array $argv = null ) : mixed
setDefaultCommand ( string $name = null ) : Console
setExitOnException ( boolean $exit = true ) : Console Sets whether to call exit(1) when an exception is caught
setOptionsParser ( consolekit\OptionsParser $parser ) : Console
setSingleCommand ( type $singleCommand ) : Console Turn off command parsing
setTextWriter ( consolekit\TextWriter $writer ) : Console
setVerboseException ( boolean $enable = true ) Sets whether a detailed error message is displayed when exception are caught
write ( string $text, $pipe = TextWriter::STDOUT ) : Console Writes some text to the text writer
writeException ( Exception $e ) : Console Writes an error message to stderr
writeln ( string $text = '', $pipe = TextWriter::STDOUT ) : Console Writes a line of text

Method Details

__construct() public méthode

public __construct ( array $commands = [], consolekit\OptionsParser $parser = null, consolekit\TextWriter $writer = null )
$commands array
$parser consolekit\OptionsParser
$writer consolekit\TextWriter

addCommand() public méthode

Registers a command
public addCommand ( callback $callback, string $alias = null, boolean $default = false ) : Console
$callback callback Associated class name, function name, Command instance or closure
$alias string Command name to be used in the shell
$default boolean True to set the command as the default one
Résultat Console

addCommands() public méthode

Adds multiple commands at once
See also: addCommand()
public addCommands ( array $commands ) : Console
$commands array
Résultat Console

addCommandsFromDir() public méthode

Registers commands from a directory
public addCommandsFromDir ( string $dir, string $namespace = '', boolean $includeFiles = false ) : Console
$dir string
$namespace string
$includeFiles boolean
Résultat Console

areExceptionsVerbose() public méthode

public areExceptionsVerbose ( ) : boolean
Résultat boolean

execute() public méthode

Executes a command
public execute ( string $command = null, array $args = [], array $options = [] ) : mixed
$command string
$args array
$options array
Résultat mixed

exitsOnException() public méthode

public exitsOnException ( ) : boolean
Résultat boolean

getCommand() public méthode

public getCommand ( string $name ) : string
$name string
Résultat string

getCommands() public méthode

public getCommands ( ) : array
Résultat array

getDefaultCommand() public méthode

public getDefaultCommand ( ) : string
Résultat string

getOptionsParser() public méthode

public getOptionsParser ( ) : consolekit\OptionsParser
Résultat consolekit\OptionsParser

getTextWriter() public méthode

public getTextWriter ( ) : consolekit\TextWriter
Résultat consolekit\TextWriter

hasCommand() public méthode

public hasCommand ( string $name ) : boolean
$name string
Résultat boolean

run() public méthode

public run ( array $argv = null ) : mixed
$argv array
Résultat mixed Results of the command callback

setDefaultCommand() public méthode

public setDefaultCommand ( string $name = null ) : Console
$name string
Résultat Console

setExitOnException() public méthode

Sets whether to call exit(1) when an exception is caught
public setExitOnException ( boolean $exit = true ) : Console
$exit boolean
Résultat Console

setOptionsParser() public méthode

public setOptionsParser ( consolekit\OptionsParser $parser ) : Console
$parser consolekit\OptionsParser
Résultat Console

setSingleCommand() public méthode

Turn off command parsing
public setSingleCommand ( type $singleCommand ) : Console
$singleCommand type
Résultat Console

setTextWriter() public méthode

public setTextWriter ( consolekit\TextWriter $writer ) : Console
$writer consolekit\TextWriter
Résultat Console

setVerboseException() public méthode

Sets whether a detailed error message is displayed when exception are caught
public setVerboseException ( boolean $enable = true )
$enable boolean

write() public méthode

Writes some text to the text writer
See also: TextWriter::write()
public write ( string $text, $pipe = TextWriter::STDOUT ) : Console
$text string
Résultat Console

writeException() public méthode

Writes an error message to stderr
public writeException ( Exception $e ) : Console
$e Exception
Résultat Console

writeln() public méthode

Writes a line of text
See also: TextWriter::writeln()
public writeln ( string $text = '', $pipe = TextWriter::STDOUT ) : Console
$text string
Résultat Console

Property Details

$commands protected_oe property

protected array $commands
Résultat array

$defaultCommand protected_oe property

protected string $defaultCommand
Résultat string

$exitOnException protected_oe property

protected bool $exitOnException
Résultat boolean

$helpCommand protected_oe property

protected string $helpCommand
Résultat string

$helpCommandClass protected_oe property

protected string $helpCommandClass
Résultat string

$optionsParser protected_oe property

protected OptionsParser,consolekit $optionsParser
Résultat consolekit\OptionsParser

$singleCommand protected_oe property

protected bool $singleCommand
Résultat boolean

$textWriter protected_oe property

protected TextWriter,consolekit $textWriter
Résultat consolekit\TextWriter

$verboseException protected_oe property

protected bool $verboseException
Résultat boolean