PHP Класс ConsoleKit\Console

Наследование: implements consolekit\TextWriter
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$commands array
$defaultCommand string
$exitOnException boolean
$helpCommand string
$helpCommandClass string
$optionsParser consolekit\OptionsParser
$singleCommand boolean
$textWriter consolekit\TextWriter
$verboseException boolean

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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

addCommand() публичный Метод

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
Результат Console

addCommands() публичный Метод

Adds multiple commands at once
См. также: addCommand()
public addCommands ( array $commands ) : Console
$commands array
Результат Console

addCommandsFromDir() публичный Метод

Registers commands from a directory
public addCommandsFromDir ( string $dir, string $namespace = '', boolean $includeFiles = false ) : Console
$dir string
$namespace string
$includeFiles boolean
Результат Console

areExceptionsVerbose() публичный Метод

public areExceptionsVerbose ( ) : boolean
Результат boolean

execute() публичный Метод

Executes a command
public execute ( string $command = null, array $args = [], array $options = [] ) : mixed
$command string
$args array
$options array
Результат mixed

exitsOnException() публичный Метод

public exitsOnException ( ) : boolean
Результат boolean

getCommand() публичный Метод

public getCommand ( string $name ) : string
$name string
Результат string

getCommands() публичный Метод

public getCommands ( ) : array
Результат array

getDefaultCommand() публичный Метод

public getDefaultCommand ( ) : string
Результат string

getOptionsParser() публичный Метод

public getOptionsParser ( ) : consolekit\OptionsParser
Результат consolekit\OptionsParser

getTextWriter() публичный Метод

public getTextWriter ( ) : consolekit\TextWriter
Результат consolekit\TextWriter

hasCommand() публичный Метод

public hasCommand ( string $name ) : boolean
$name string
Результат boolean

run() публичный Метод

public run ( array $argv = null ) : mixed
$argv array
Результат mixed Results of the command callback

setDefaultCommand() публичный Метод

public setDefaultCommand ( string $name = null ) : Console
$name string
Результат Console

setExitOnException() публичный Метод

Sets whether to call exit(1) when an exception is caught
public setExitOnException ( boolean $exit = true ) : Console
$exit boolean
Результат Console

setOptionsParser() публичный Метод

public setOptionsParser ( consolekit\OptionsParser $parser ) : Console
$parser consolekit\OptionsParser
Результат Console

setSingleCommand() публичный Метод

Turn off command parsing
public setSingleCommand ( type $singleCommand ) : Console
$singleCommand type
Результат Console

setTextWriter() публичный Метод

public setTextWriter ( consolekit\TextWriter $writer ) : Console
$writer consolekit\TextWriter
Результат Console

setVerboseException() публичный Метод

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

write() публичный Метод

Writes some text to the text writer
См. также: TextWriter::write()
public write ( string $text, $pipe = TextWriter::STDOUT ) : Console
$text string
Результат Console

writeException() публичный Метод

Writes an error message to stderr
public writeException ( Exception $e ) : Console
$e Exception
Результат Console

writeln() публичный Метод

Writes a line of text
См. также: TextWriter::writeln()
public writeln ( string $text = '', $pipe = TextWriter::STDOUT ) : Console
$text string
Результат Console

Описание свойств

$commands защищенное свойство

protected array $commands
Результат array

$defaultCommand защищенное свойство

protected string $defaultCommand
Результат string

$exitOnException защищенное свойство

protected bool $exitOnException
Результат boolean

$helpCommand защищенное свойство

protected string $helpCommand
Результат string

$helpCommandClass защищенное свойство

protected string $helpCommandClass
Результат string

$optionsParser защищенное свойство

protected OptionsParser,consolekit $optionsParser
Результат consolekit\OptionsParser

$singleCommand защищенное свойство

protected bool $singleCommand
Результат boolean

$textWriter защищенное свойство

protected TextWriter,consolekit $textWriter
Результат consolekit\TextWriter

$verboseException защищенное свойство

protected bool $verboseException
Результат boolean