PHP 클래스 DataSift\Storyplayer\Output

저자: Stuart Herbert ([email protected])
상속: extends DataSift\Storyplayer\OutputLib\OutputPlugin
파일 보기 프로젝트 열기: datasift/storyplayer 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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