PHP Класс pho\Console\Console

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$formatter
$options

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

Метод Описание
__construct ( array $arguments, string $stream ) The constructor stores the arguments to be parsed, and creates instances of both ConsoleFormatter and ConsoleOptionParser. Also, if either a test or spec directory exists, they are set as the default paths to traverse.
getExitStatus ( ) : mixed Returns the error status that should be used to exit after parsing, otherwise it returns null.
getPaths ( ) : array Returns an array of strings corresponding to file and directory paths to be traversed.
getReporterClass ( ) : string Returns the namespaced name of the reporter class requested via the command line arguments, defaulting to DotReporter if not specified.
parseArguments ( ) Parses the arguments originally supplied via the constructor, assigning their values to the option keys in the $options array. If the arguments included the help or version option, the corresponding text is printed.
setExitStatus ( integer $exitStatus ) Sets the error code to be returned.
write ( string $string ) Outputs a single line, replacing all occurrences of the newline character in the string with PHP_EOL for cross-platform support.
writeLn ( string $string ) Outputs a line, followed by a newline, while replacing all occurrences of '\n' in the string with PHP_EOL for cross-platform support.

Приватные методы

Метод Описание
printHelp ( ) Outputs the help text, as required when the --help/-h flag is used. It's done by iterating over $this->availableOptions.
printVersion ( ) Outputs the version information, as defined in the VERSION constant.

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

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

The constructor stores the arguments to be parsed, and creates instances of both ConsoleFormatter and ConsoleOptionParser. Also, if either a test or spec directory exists, they are set as the default paths to traverse.
public __construct ( array $arguments, string $stream )
$arguments array An array of argument strings
$stream string The I/O stream to use when writing

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

Returns the error status that should be used to exit after parsing, otherwise it returns null.
public getExitStatus ( ) : mixed
Результат mixed An integer error status, or null

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

Returns an array of strings corresponding to file and directory paths to be traversed.
public getPaths ( ) : array
Результат array An array of paths

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

Returns the namespaced name of the reporter class requested via the command line arguments, defaulting to DotReporter if not specified.
public getReporterClass ( ) : string
Результат string The namespaced class name of the reporter

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

Furthermore, if the arguments included a non-valid flag or option, or if any of the listed paths were invalid, error message is printed.
public parseArguments ( )

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

Sets the error code to be returned.
public setExitStatus ( integer $exitStatus )
$exitStatus integer An integer return code or exit status

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

Outputs a single line, replacing all occurrences of the newline character in the string with PHP_EOL for cross-platform support.
public write ( string $string )
$string string The string to print

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

Outputs a line, followed by a newline, while replacing all occurrences of '\n' in the string with PHP_EOL for cross-platform support.
public writeLn ( string $string )
$string string The string to print

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

$formatter публичное свойство

public $formatter

$options публичное свойство

public $options