ComponentCheckCommands
extends AbstractCommands
in package
Command class for toolkit:component-check.
Tags
Table of Contents
Properties
- $abandonedFailed : bool
- $composerFailed : bool
- $composerLock : array<string|int, mixed>
- The composer.lock content.
- $composerOutdated : array<string|int, mixed>
- The composer outdated packages.
- $configurationFailed : bool
- $devCompRequireFailed : bool
- $disabledConfigReadonly : bool
- $evaluationFailed : bool
- $forcedUpdateModule : bool
- $insecureFailed : bool
- $insecureNpmFailed : bool
- $io : mixed
- $mandatoryFailed : bool
- $optsYml : array<string|int, mixed>
- The opts.yml content.
- $outdatedFailed : bool
- $outdatedNpmFailed : bool
- $packageReviews : array<string|int, mixed>
- The packages from the website.
- $recommendedFailed : bool
- $recommendedFailedCount : int
- $skipAbandoned : bool
- $skipInsecure : bool
- $skipInsecureNpm : bool
- $skipOutdated : bool
- $skipOutdatedNpm : bool
- $skipRecommended : bool
- $skipUnsupported : bool
- $unsupportedFailed : bool
Methods
- componentAbandoned() : mixed
- Check abandoned components.
- componentCheck() : int|void
- Check composer for components that are not whitelisted/blacklisted.
- componentComposer() : void|int
- Check composer packages.
- componentConfiguration() : void
- Check project configuration.
- componentDevelopment() : int|void
- Check development components.
- componentEvaluation() : int|void
- Check Evaluation components.
- componentInsecure() : int|void
- Check insecure components.
- componentMandatory() : int|void
- Check mandatory components.
- componentNpmInsecure() : int|void
- Run NPM Insecure.
- componentNpmOutdated() : int|void
- Run NPM Outdated.
- componentOutdated() : void
- Check outdated components.
- componentRecommended() : bool|string|int|void
- Check recommended components.
- componentUnsupported() : void
- Check unsupported components.
- getConfigurationFile() : string
- Path to YAML configuration file containing command defaults.
- getJson() : array<string|int, mixed>
- Returns the JSON parsed content.
- getWorkingDir() : string
- Returns the current working directory.
- isWebsiteInstalled() : bool
- Check if the website is installed.
- getBin() : string
- Validate and return the path to given bin.
- getBinPath() : string
- Return the path to given bin.
- getConfigValue() : mixed|null
- Return the configuration value.
- getNodeBin() : string
- Validate and return the path to given bin from node packages.
- getNodeBinPath() : string
- Return the path to given bin from node packages.
- isJunit() : bool
- Check whether Junit option is being used, or env var is set.
- isSimulating() : bool
- Check if current command is being executed with option simulate.
- prepareSkips() : void
- Prepare the overrides from config and commit message.
- printComponentResults() : void
- Print the component check results.
- taskExecute() : CollectionBuilder
- Execute a command.
- taskProcess() : ReplaceBlock|CollectionBuilder
- Process the file.
- taskReplaceBlock() : ReplaceBlock|CollectionBuilder
- Replace block in a file.
- validateComponent() : array<string|int, string>|void
- Helper function to validate the component.
- validateEnvironmentVariables() : void
- Component Configuration Helper - Validate environment variables.
- addJunitResult() : void
- Add a result to junit if it is enabled.
- disableConfigReadOnly() : void
- Ensure that config_readonly is not active by commenting the config line.
- getFailedOrPassed() : string
- If given bool is TRUE 'failed' is return, otherwise 'passed'.
- getOptsYml() : array<string|int, mixed>
- Returns the .opts.yml content.
- getProjectProfile() : string
- Load given project from website and return the profile in the production env.
- getRecommendedWarningMessage() : string
- Returns the recommended components warning message.
- getReleases() : array<string|int, mixed>
- Returns the modules releases.
- loadComposerLock() : bool
- Loads the composer lock packages.
- loadComposerOutdated() : bool
- Loads the composer outdated results.
- loadWebsitePackages() : bool
- Loads the packages from the website.
- restoreConfigReadOnly() : void
- Restore the comment added to the config_readonly setting.
- testPackages() : array<string|int, array<string|int, string>>
- Returns a list of packages to test.
Properties
$abandonedFailed
protected
bool
$abandonedFailed
= false
$composerFailed
protected
bool
$composerFailed
= false
$composerLock
The composer.lock content.
protected
array<string|int, mixed>
$composerLock
$composerOutdated
The composer outdated packages.
protected
array<string|int, mixed>
$composerOutdated
$configurationFailed
protected
bool
$configurationFailed
= false
$devCompRequireFailed
protected
bool
$devCompRequireFailed
= false
$disabledConfigReadonly
protected
bool
$disabledConfigReadonly
= false
$evaluationFailed
protected
bool
$evaluationFailed
= false
$forcedUpdateModule
protected
bool
$forcedUpdateModule
= false
$insecureFailed
protected
bool
$insecureFailed
= false
$insecureNpmFailed
protected
bool
$insecureNpmFailed
= false
$io
protected
mixed
$io
$mandatoryFailed
protected
bool
$mandatoryFailed
= false
$optsYml
The opts.yml content.
protected
array<string|int, mixed>
$optsYml
$outdatedFailed
protected
bool
$outdatedFailed
= false
$outdatedNpmFailed
protected
bool
$outdatedNpmFailed
= false
$packageReviews
The packages from the website.
protected
array<string|int, mixed>
$packageReviews
$recommendedFailed
protected
bool
$recommendedFailed
= false
$recommendedFailedCount
protected
int
$recommendedFailedCount
= 0
$skipAbandoned
protected
bool
$skipAbandoned
= false
$skipInsecure
protected
bool
$skipInsecure
= false
$skipInsecureNpm
protected
bool
$skipInsecureNpm
= true
$skipOutdated
protected
bool
$skipOutdated
= false
$skipOutdatedNpm
protected
bool
$skipOutdatedNpm
= true
$skipRecommended
protected
bool
$skipRecommended
= false
$skipUnsupported
protected
bool
$skipUnsupported
= false
$unsupportedFailed
protected
bool
$unsupportedFailed
= false
Methods
componentAbandoned()
Check abandoned components.
public
componentAbandoned(ConsoleIO $io) : mixed
Parameters
- $io : ConsoleIO
Tags
Return values
mixed —The component abandoned status.
componentCheck()
Check composer for components that are not whitelisted/blacklisted.
public
componentCheck(ConsoleIO $io[, array<string|int, mixed> $options = ['endpoint' => InputOption::VALUE_REQUIRED, 'test-command' => false] ]) : int|void
Parameters
- $io : ConsoleIO
- $options : array<string|int, mixed> = ['endpoint' => InputOption::VALUE_REQUIRED, 'test-command' => false]
-
Command options.
Tags
Return values
int|void —The component check status.
componentComposer()
Check composer packages.
public
componentComposer(ConsoleIO $io) : void|int
Parameters
- $io : ConsoleIO
Tags
Return values
void|int —The component composer status.
componentConfiguration()
Check project configuration.
public
componentConfiguration(ConsoleIO $io) : void
Parameters
- $io : ConsoleIO
Tags
Return values
void —The component configuration status.
componentDevelopment()
Check development components.
public
componentDevelopment(ConsoleIO $io) : int|void
Parameters
- $io : ConsoleIO
Tags
Return values
int|void —The component development status.
componentEvaluation()
Check Evaluation components.
public
componentEvaluation(ConsoleIO $io) : int|void
Parameters
- $io : ConsoleIO
Tags
Return values
int|void —The check evaluation status.
componentInsecure()
Check insecure components.
public
componentInsecure(ConsoleIO $io) : int|void
Parameters
- $io : ConsoleIO
Tags
Return values
int|void —The component insecure result.
componentMandatory()
Check mandatory components.
public
componentMandatory(ConsoleIO $io) : int|void
Parameters
- $io : ConsoleIO
Tags
Return values
int|void —The component mandatory result.
componentNpmInsecure()
Run NPM Insecure.
public
componentNpmInsecure() : int|void
Tags
Return values
int|void —The component NPM insecure status.
componentNpmOutdated()
Run NPM Outdated.
public
componentNpmOutdated() : int|void
Tags
Return values
int|void —The check NPM outdated status.
componentOutdated()
Check outdated components.
public
componentOutdated(ConsoleIO $io) : void
Parameters
- $io : ConsoleIO
Tags
Return values
void —The component Outdated result.
componentRecommended()
Check recommended components.
public
componentRecommended(ConsoleIO $io) : bool|string|int|void
Parameters
- $io : ConsoleIO
Tags
Return values
bool|string|int|void —The component recommended result.
componentUnsupported()
Check unsupported components.
public
componentUnsupported(ConsoleIO $io) : void
Parameters
- $io : ConsoleIO
Tags
Return values
void —The component unsupported status.
getConfigurationFile()
Path to YAML configuration file containing command defaults.
public
getConfigurationFile() : string
Command classes should implement this method.
Return values
string —Configuration file path.
getJson()
Returns the JSON parsed content.
public
getJson(string $filename[, bool $throwException = true ]) : array<string|int, mixed>
Parameters
- $filename : string
- $throwException : bool = true
-
If the file is not found.
Return values
array<string|int, mixed> —Json parsed content.
getWorkingDir()
Returns the current working directory.
public
getWorkingDir() : string
Return values
string —The current working directory.
isWebsiteInstalled()
Check if the website is installed.
public
isWebsiteInstalled() : bool
Return values
boolgetBin()
Validate and return the path to given bin.
protected
getBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getBinPath()
Return the path to given bin.
protected
getBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
getConfigValue()
Return the configuration value.
protected
getConfigValue(string $key[, mixed|null $default = null ]) : mixed|null
Parameters
- $key : string
-
The config item to look up.
- $default : mixed|null = null
-
Default configuration value for the key item if neither has value nor exists.
Return values
mixed|null —The configuration value.
getNodeBin()
Validate and return the path to given bin from node packages.
protected
getNodeBin(string $name) : string
Parameters
- $name : string
-
The bin to look for.
Tags
Return values
string —The bin path.
getNodeBinPath()
Return the path to given bin from node packages.
protected
getNodeBinPath(string $name) : string
Parameters
- $name : string
Return values
string —The path to given binary.
isJunit()
Check whether Junit option is being used, or env var is set.
protected
isJunit() : bool
Return values
boolisSimulating()
Check if current command is being executed with option simulate.
protected
isSimulating() : bool
Return values
bool —True if using --simulate, false otherwise.
prepareSkips()
Prepare the overrides from config and commit message.
protected
prepareSkips() : void
printComponentResults()
Print the component check results.
protected
printComponentResults(ConsoleIO $io) : void
Parameters
- $io : ConsoleIO
Tags
Return values
void —The printed component list results.
taskExecute()
Execute a command.
protected
taskExecute(array<string|int, string> $tasks) : CollectionBuilder
Parameters
- $tasks : array<string|int, string>
-
An array with tasks to execute.
Return values
CollectionBuilder —The task executed.
taskProcess()
Process the file.
protected
taskProcess(string $source[, string $destination = '' ]) : ReplaceBlock|CollectionBuilder
Parameters
- $source : string
-
The source file to process.
- $destination : string = ''
-
The destination file.
Return values
ReplaceBlock|CollectionBuilder —The file task processed.
taskReplaceBlock()
Replace block in a file.
protected
taskReplaceBlock([string $filename = '' ]) : ReplaceBlock|CollectionBuilder
Parameters
- $filename : string = ''
-
The file to process.
Return values
ReplaceBlock|CollectionBuilder —The file replaced.
validateComponent()
Helper function to validate the component.
protected
validateComponent(array<string|int, mixed> $package) : array<string|int, string>|void
Parameters
- $package : array<string|int, mixed>
-
The package to validate.
Tags
Return values
array<string|int, string>|void —The validate component status.
validateEnvironmentVariables()
Component Configuration Helper - Validate environment variables.
protected
validateEnvironmentVariables() : void
Tags
Return values
void —Environment variable validated.
addJunitResult()
Add a result to junit if it is enabled.
private
addJunitResult(string $testCase, string $message[, string $type = 'error' ]) : void
All test case will be added to the test suite 'Component check'.
Parameters
- $testCase : string
-
The name of the test.
- $message : string
-
The message for the failure.
- $type : string = 'error'
-
The type of failure.
Tags
disableConfigReadOnly()
Ensure that config_readonly is not active by commenting the config line.
private
disableConfigReadOnly() : void
Return values
void —The config_readonly disabled.
getFailedOrPassed()
If given bool is TRUE 'failed' is return, otherwise 'passed'.
private
getFailedOrPassed(bool $value) : string
Parameters
- $value : bool
-
The value to check.
Return values
stringgetOptsYml()
Returns the .opts.yml content.
private
getOptsYml() : array<string|int, mixed>
Return values
array<string|int, mixed> —The opts.yml file content.
getProjectProfile()
Load given project from website and return the profile in the production env.
private
getProjectProfile(string $projectId) : string
Parameters
- $projectId : string
-
The project to use in the endpoint.
Return values
stringgetRecommendedWarningMessage()
Returns the recommended components warning message.
private
getRecommendedWarningMessage() : string
Return values
stringgetReleases()
Returns the modules releases.
private
getReleases() : array<string|int, mixed>
If the update module is not enabled, it will be enabled, and later disabled.
Return values
array<string|int, mixed> —The module releases.
loadComposerLock()
Loads the composer lock packages.
private
loadComposerLock() : bool
Return values
boolloadComposerOutdated()
Loads the composer outdated results.
private
loadComposerOutdated() : bool
Return values
boolloadWebsitePackages()
Loads the packages from the website.
private
loadWebsitePackages() : bool
Return values
boolrestoreConfigReadOnly()
Restore the comment added to the config_readonly setting.
private
restoreConfigReadOnly() : void
Return values
void —The settings for the config_readonly restored.
testPackages()
Returns a list of packages to test.
private
testPackages() : array<string|int, array<string|int, string>>
Return values
array<string|int, array<string|int, string>> —The list of packages to test array.