PHP Class pho\Console\Console

Afficher le fichier Open project: danielstjules/pho Class Usage Examples

Méthodes publiques

Свойство Type Description
$formatter
$options

Méthodes publiques

Méthode Description
__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.

Private Methods

Méthode Description
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.

Method Details

__construct() public méthode

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() public méthode

Returns the error status that should be used to exit after parsing, otherwise it returns null.
public getExitStatus ( ) : mixed
Résultat mixed An integer error status, or null

getPaths() public méthode

Returns an array of strings corresponding to file and directory paths to be traversed.
public getPaths ( ) : array
Résultat array An array of paths

getReporterClass() public méthode

Returns the namespaced name of the reporter class requested via the command line arguments, defaulting to DotReporter if not specified.
public getReporterClass ( ) : string
Résultat string The namespaced class name of the reporter

parseArguments() public méthode

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() public méthode

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

write() public méthode

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() public méthode

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

Property Details

$formatter public_oe property

public $formatter

$options public_oe property

public $options