PHP Class DataSift\Storyplayer\Output

Inheritance: extends DataSift\Storyplayer\OutputLib\OutputPlugin
Afficher le fichier Open project: datasift/storyplayer Class Usage Examples

Protected Properties

Свойство Type Description
$activityLog array this is used for producing detailed error reports when something has gone badly wrong
$plugins array a list of the plugins that are currently active

Méthodes publiques

Méthode Description
__construct ( ) constructor
disableColourSupport ( ) : void disables any colour output
enableColourSupport ( ) : void asks each active plugin to switch on colour support if possible
endPhase ( Phase $phase, Phase_Result $phaseResult ) : void called when a story ends a phase
endPhaseGroup ( PhaseGroup_Result $result ) : void called when we have finished playing a PhaseGroup
endStoryplayer ( float $duration ) : integer called when Storyplayer exits
enforceColourSupport ( ) : void forces switching on colour support
getActiveConsolePlugin ( ) : Console | null return the active plugin in the 'console' slot
getActivePluginInSlot ( string $slotName ) : OutputPlugin | null return the active plugin in the named slot
getPlugins ( ) : array get the array of all plugins
logCliError ( string $msg ) : void called when the outer CLI shell encounters a fatal error
logCliErrorWithException ( string $msg, Exception $e ) : void called when the outer CLI shell encounters a fatal error
logCliInfo ( string $msg ) : void called when the outer CLI shell needs to tell the user something
logCliWarning ( string $msg ) : void called when the outer CLI shell needs to publish a warning
logPhaseActivity ( string $msg, array | null $codeLine = null ) : void called when a story logs an action
logPhaseCodeLine ( array $codeLine ) : void called when we want to record which line of code in a phase is currently executing
logPhaseError ( string $phaseName, string $msg ) : void called when a story logs an error
logPhaseSkipped ( string $phaseName, string $msg ) : void called when a story is skipped
logPhaseSubprocessOutput ( string $msg ) : void called when a story logs the (possibly partial) output from running a subprocess
logVardump ( string $name, mixed $var ) : void an alternative to using PHP's built-in var_dump()
resetSilentMode ( ) : void disable 'silent' mode
setSilentMode ( ) : void switches 'silent' mode on
startPhase ( $phase ) : void called when a story starts a new phase
startPhaseGroup ( string $activity, string $name ) : void called when we start playing a new PhaseGroup
startStoryplayer ( string $version, string $url, string $copyright, string $license ) : void called when storyplayer starts
usePluginAsConsole ( Console $plugin ) : void make a plugin the one that we use when writing to the user's console
usePluginInSlot ( OutputPlugin $plugin, string $slotName ) set the plugin for a named output slot

Method Details

__construct() public méthode

ensures we have a default console that is connected to stdout
public __construct ( )

disableColourSupport() public méthode

disables any colour output
public disableColourSupport ( ) : void
Résultat void

enableColourSupport() public méthode

a plugin may still choose to not output colour. one example of this are consoles. they're happy to output colour if talking to a terminal, but choose not to output colour if they're only writing to log files or to a pipe into another UNIX process.
public enableColourSupport ( ) : void
Résultat void

endPhase() public méthode

called when a story ends a phase
public endPhase ( Phase $phase, Phase_Result $phaseResult ) : void
$phase DataSift\Storyplayer\Phases\Phase the phase that has finished
$phaseResult DataSift\Storyplayer\PlayerLib\Phase_Result the result of running $phase
Résultat void

endPhaseGroup() public méthode

NOTE: we cannot use a type-hint for $result here. we may pass in a class that inherits from PhaseGroup_Result, and (annoyingly) this isn't allowed if we use a type-hint (grrrr)
public endPhaseGroup ( PhaseGroup_Result $result ) : void
$result DataSift\Storyplayer\PlayerLib\PhaseGroup_Result
Résultat void

endStoryplayer() public méthode

called when Storyplayer exits
public endStoryplayer ( float $duration ) : integer
$duration float how long did storyplayer take to run (in seconds)?
Résultat integer

enforceColourSupport() public méthode

forces switching on colour support
public enforceColourSupport ( ) : void
Résultat void

getActiveConsolePlugin() public méthode

return the active plugin in the 'console' slot
public getActiveConsolePlugin ( ) : Console | null
Résultat DataSift\Storyplayer\Console\Console | null

getActivePluginInSlot() public méthode

return the active plugin in the named slot
public getActivePluginInSlot ( string $slotName ) : OutputPlugin | null
$slotName string
Résultat DataSift\Storyplayer\OutputLib\OutputPlugin | null

getPlugins() public méthode

get the array of all plugins
public getPlugins ( ) : array
Résultat array

logCliError() public méthode

called when the outer CLI shell encounters a fatal error
public logCliError ( string $msg ) : void
$msg string the error message to show the user
Résultat void

logCliErrorWithException() public méthode

called when the outer CLI shell encounters a fatal error
public logCliErrorWithException ( string $msg, Exception $e ) : void
$msg string the error message to show the user
$e Exception the exception that caused the error
Résultat void

logCliInfo() public méthode

called when the outer CLI shell needs to tell the user something
public logCliInfo ( string $msg ) : void
$msg string the message to show the user
Résultat void

logCliWarning() public méthode

called when the outer CLI shell needs to publish a warning
public logCliWarning ( string $msg ) : void
$msg string the warning message to show the user
Résultat void

logPhaseActivity() public méthode

called when a story logs an action
public logPhaseActivity ( string $msg, array | null $codeLine = null ) : void
$msg string the message to write to the logs / console
$codeLine array | null information about the line of code that is executing
Résultat void

logPhaseCodeLine() public méthode

called when we want to record which line of code in a phase is currently executing
public logPhaseCodeLine ( array $codeLine ) : void
$codeLine array details about the line of code that is executing
Résultat void

logPhaseError() public méthode

called when a story logs an error
public logPhaseError ( string $phaseName, string $msg ) : void
$phaseName string the name of the phase where the error occurred
$msg string an error message to send to console|logfile
Résultat void

logPhaseSkipped() public méthode

called when a story is skipped
public logPhaseSkipped ( string $phaseName, string $msg ) : void
$phaseName string the name of the phase where the error occurred
$msg string an informational message to send to console|logfile
Résultat void

logPhaseSubprocessOutput() public méthode

called when a story logs the (possibly partial) output from running a subprocess
public logPhaseSubprocessOutput ( string $msg ) : void
$msg string the output to log
Résultat void

logVardump() public méthode

an alternative to using PHP's built-in var_dump()
public logVardump ( string $name, mixed $var ) : void
$name string a human-readable name to describe $var
$var mixed the variable to dump
Résultat void

resetSilentMode() public méthode

NOTE: it is up to each plugin in turn whether or not to support 'silent' mode at all
public resetSilentMode ( ) : void
Résultat void

setSilentMode() public méthode

in 'silent' mode, we do not write log activity to the output writer at all. HOWEVER, the plugin may still add the log activity to any internal cache it has (can be useful for error reports etc)
public setSilentMode ( ) : void
Résultat void

startPhase() public méthode

$param Phase $phase the phase that we are executing
public startPhase ( $phase ) : void
Résultat void

startPhaseGroup() public méthode

called when we start playing a new PhaseGroup
public startPhaseGroup ( string $activity, string $name ) : void
$activity string what are we doing? (e.g. 'creating', 'running')
$name string the name of the phase group
Résultat void

startStoryplayer() public méthode

called when storyplayer starts
public startStoryplayer ( string $version, string $url, string $copyright, string $license ) : void
$version string
$url string
$copyright string
$license string
Résultat void

usePluginAsConsole() public méthode

make a plugin the one that we use when writing to the user's console
public usePluginAsConsole ( Console $plugin ) : void
$plugin DataSift\Storyplayer\Console\Console the plugin that we want
Résultat void

usePluginInSlot() public méthode

set the plugin for a named output slot
public usePluginInSlot ( OutputPlugin $plugin, string $slotName )
$plugin DataSift\Storyplayer\OutputLib\OutputPlugin the plugin to use in the slot
$slotName string the name of the slot to use for this plugin

Property Details

$activityLog protected_oe property

this is used for producing detailed error reports when something has gone badly wrong
protected array $activityLog
Résultat array

$plugins protected_oe property

a list of the plugins that are currently active
protected array $plugins
Résultat array