PHP Класс DataSift\Storyplayer\Output

Автор: Stuart Herbert ([email protected])
Наследование: extends DataSift\Storyplayer\OutputLib\OutputPlugin
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$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

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

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

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

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

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

disableColourSupport() публичный метод

disables any colour output
public disableColourSupport ( ) : void
Результат void

enableColourSupport() публичный метод

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

endPhase() публичный метод

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

endPhaseGroup() публичный метод

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

endStoryplayer() публичный метод

called when Storyplayer exits
public endStoryplayer ( float $duration ) : integer
$duration float how long did storyplayer take to run (in seconds)?
Результат integer

enforceColourSupport() публичный метод

forces switching on colour support
public enforceColourSupport ( ) : void
Результат void

getActiveConsolePlugin() публичный метод

return the active plugin in the 'console' slot
public getActiveConsolePlugin ( ) : Console | null
Результат DataSift\Storyplayer\Console\Console | null

getActivePluginInSlot() публичный метод

return the active plugin in the named slot
public getActivePluginInSlot ( string $slotName ) : OutputPlugin | null
$slotName string
Результат DataSift\Storyplayer\OutputLib\OutputPlugin | null

getPlugins() публичный метод

get the array of all plugins
public getPlugins ( ) : array
Результат array

logCliError() публичный метод

called when the outer CLI shell encounters a fatal error
public logCliError ( string $msg ) : void
$msg string the error message to show the user
Результат void

logCliErrorWithException() публичный метод

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

logCliInfo() публичный метод

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

logCliWarning() публичный метод

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

logPhaseActivity() публичный метод

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

logPhaseCodeLine() публичный метод

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

logPhaseError() публичный метод

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

logPhaseSkipped() публичный метод

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

logPhaseSubprocessOutput() публичный метод

called when a story logs the (possibly partial) output from running a subprocess
public logPhaseSubprocessOutput ( string $msg ) : void
$msg string the output to log
Результат void

logVardump() публичный метод

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

resetSilentMode() публичный метод

NOTE: it is up to each plugin in turn whether or not to support 'silent' mode at all
public resetSilentMode ( ) : void
Результат void

setSilentMode() публичный метод

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

startPhase() публичный метод

$param Phase $phase the phase that we are executing
public startPhase ( $phase ) : void
Результат void

startPhaseGroup() публичный метод

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

startStoryplayer() публичный метод

called when storyplayer starts
public startStoryplayer ( string $version, string $url, string $copyright, string $license ) : void
$version string
$url string
$copyright string
$license string
Результат void

usePluginAsConsole() публичный метод

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

usePluginInSlot() публичный метод

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

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

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

this is used for producing detailed error reports when something has gone badly wrong
protected array $activityLog
Результат array

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

a list of the plugins that are currently active
protected array $plugins
Результат array