StandardsCommand
Executes the full suite of Fast Forward code standard checks.
Description
This class MUST NOT be modified through inheritance and SHALL streamline code validation workflows.
'dev-tools:standards'
'Runs Fast Forward code standards checks.'
['standards']
Properties
Methods
Adds the standard cache directory option to the current command.
Adds the standard cache control option to the current command.
Adds the standard JSON output options to the current command.
Configures constraints and arguments for the collective standard runner.
Resolves whether cache writes SHOULD be enabled for the current invocation.
Determines whether JSON output was requested.
Determines whether pretty JSON output was requested.
Returns the explicit cache flag that SHOULD be forwarded to nested commands.
Resolves a nested cache directory for a child command.
Logs a failed command result and returns the failure exit code.
Resolves a human-readable process label for a nested standards command.
Determines whether the current invocation explicitly passed `--cache-dir`.
Determines whether cache writes were explicitly disabled for the current invocation.
Logs an informational command message at notice level.
Logs a successful command result and returns the success exit code.
private
LoggerInterface
$logger
private
ProcessBuilderInterface
$processBuilder
private
ProcessQueueInterface
$processQueue
public
__construct(ProcessBuilderInterface
$processBuilder, ProcessQueueInterface
$processQueue, LoggerInterface
$logger) : mixed
Parameters
$logger
:
LoggerInterface
Adds the standard cache directory option to the current command.
protected
addCacheDirOption(
string
$description,
string
$default) : static
Parameters
$description
:
string
Description
the cache directory option description
$default
:
string
Description
the command-specific default cache directory
Return values
Adds the standard cache control option to the current command.
protected
addCacheOption(
string
$description) : static
Parameters
$description
:
string
Description
the cache option description
Return values
Adds the standard JSON output options to the current command.
protected
addJsonOption() : static
Return values
Configures constraints and arguments for the collective standard runner.
protected
configure() : void
protected
execute(InputInterface
$input, OutputInterface
$output) : int
Parameters
$input
:
InputInterface
$output
:
OutputInterface
Return values
Resolves whether cache writes SHOULD be enabled for the current invocation.
protected
isCacheEnabled(InputInterface
$input[,
bool
$default = true]) : bool
Parameters
$input
:
InputInterface
Description
the current command input
$default
:
bool
=
true
Description
the command-specific default cache behavior when the option is omitted
Return values
Determines whether JSON output was requested.
protected
isJsonOutput(InputInterface
$input) : bool
Description
The pretty-json flag SHALL imply JSON output.
Parameters
$input
:
InputInterface
Return values
Determines whether pretty JSON output was requested.
protected
isPrettyJsonOutput(InputInterface
$input) : bool
Parameters
$input
:
InputInterface
Return values
Returns the explicit cache flag that SHOULD be forwarded to nested commands.
protected
resolveCacheArgument(InputInterface
$input) : string|null
Parameters
$input
:
InputInterface
Description
the current command input
Return values
Resolves a nested cache directory for a child command.
protected
resolveCacheDirArgument(InputInterface
$input[,
string
$path = '']) : string|null
Parameters
$input
:
InputInterface
Description
the current command input
$path
:
string
=
''
Description
the child cache path relative to the current command cache root
Return values
Logs a failed command result and returns the failure exit code.
private
failure(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string|null
$file = null][,
int|null
$line = null]) : int
Parameters
$message
:
string
Description
the failure message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$file
:
string|null
=
null
Description
the related file path when known
$line
:
int|null
=
null
Description
the related line when known
Return values
Resolves a human-readable process label for a nested standards command.
private
getProcessLabel(
string
$command) : string
Parameters
$command
:
string
Description
the nested dev-tools command name
Return values
Description
the process section label
Determines whether the current invocation explicitly passed `--cache-dir`.
private
hasExplicitCacheDirArgument(InputInterface
$input) : bool
Parameters
$input
:
InputInterface
Description
the current command input
Return values
Determines whether cache writes were explicitly disabled for the current invocation.
private
isNoCacheRequested(InputInterface
$input) : bool
Description
The Composer application already provides a global --no-cache flag, so commands
SHALL reuse that switch instead of redefining a local negated variant.
Parameters
$input
:
InputInterface
Description
the current command input
Return values
Logs an informational command message at notice level.
private
notice(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []]) : void
Parameters
$message
:
string
Description
the notice message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
Logs a successful command result and returns the success exit code.
private
success(
string
$message, InputInterface
$input[,
array<string, mixed>
$context = []][,
string
$logLevel = LogLevel::INFO]) : int
Parameters
$message
:
string
Description
the success message
$input
:
InputInterface
Description
the originating command input
$context
:
array<string, mixed>
=
[]
Description
optional extra log context
$logLevel
:
string
=
LogLevel::INFO
Description
the PSR-3 log level used for the successful result