-
Notifications
You must be signed in to change notification settings - Fork 0
SyncCommand
Represents the command responsible for installing development scripts into composer.json.
This class MUST NOT be overridden and SHALL rely on the ScriptsInstallerTrait.
- Full name:
\FastForward\DevTools\Command\SyncCommand - Parent class:
\FastForward\DevTools\Command\AbstractCommand - This class is marked as final and can't be subclassed
- This class is a Final class
Configures the current command.
protected configure(): voidThis method MUST define the name, description, and help text for the command. It SHALL identify the tool as the mechanism for script synchronization.
Executes the script installation block.
protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): intThe method MUST leverage the ScriptsInstallerTrait to update the configuration.
It SHALL return self::SUCCESS upon completion.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$input |
\Symfony\Component\Console\Input\InputInterface | the input interface |
$output |
\Symfony\Component\Console\Output\OutputInterface | the output interface |
Return Value:
the status code of the command
Constructs a new AbstractCommand instance.
public __construct(\Symfony\Component\Filesystem\Filesystem|null $filesystem = null): mixedThe method MAY accept a Filesystem instance; if omitted, it SHALL instantiate a new one.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$filesystem |
\Symfony\Component\Filesystem\Filesystem|null | the filesystem utility to use |
Executes a given system process gracefully and outputs its buffer.
protected runProcess(\Symfony\Component\Process\Process $command, \Symfony\Component\Console\Output\OutputInterface $output): intThe method MUST execute the provided command ensuring the output is channeled
to the OutputInterface. It SHOULD leverage TTY if supported. If the process
fails, it MUST return self::FAILURE; otherwise, it SHALL return self::SUCCESS.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$command |
\Symfony\Component\Process\Process | the configured process instance to run |
$output |
\Symfony\Component\Console\Output\OutputInterface | the output interface to log warnings or results |
Return Value:
the status code of the command execution
Retrieves the current working directory of the application.
protected getCurrentWorkingDirectory(): stringThe method MUST return the initial working directory defined by the application. If not available, it SHALL fall back to the safe current working directory.
Return Value:
the absolute path to the current working directory
Computes the absolute path for a given relative or absolute path.
protected getAbsolutePath(string $relativePath): stringThis method MUST return the exact path if it is already absolute. If relative, it SHALL make it absolute relying on the current working directory.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$relativePath |
string | the path to evaluate or resolve |
Return Value:
the resolved absolute path
Determines the correct absolute path to a configuration file.
protected getConfigFile(string $filename, bool $force = false): stringThe method MUST attempt to resolve the configuration file locally in the working directory. If absent and not forced, it SHALL provide the default equivalent from the package itself.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$filename |
string | the name of the configuration file |
$force |
bool | determines whether to bypass fallback and forcefully return the local file path |
Return Value:
the resolved absolute path to the configuration file
Resolves the absolute path to a file within the fast-forward/dev-tools package.
protected getDevToolsFile(string $filename): stringThis method uses Composer's InstalledVersions to determine the installation path of the fast-forward/dev-tools package and returns the absolute path to the given filename within it. It is used as a fallback when a configuration file is not found in the project root.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$filename |
string | the name of the file to resolve within the dev-tools package |
Return Value:
the absolute path to the file inside the dev-tools package
Configures and executes a registered console command by name.
protected runCommand(string $commandName, array|\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): intThe method MUST look up the command from the application and run it. It SHALL ignore generic validation errors and route the custom input and output correctly.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$commandName |
string | the name of the required command |
$input |
array|\Symfony\Component\Console\Input\InputInterface | the input arguments or array definition |
$output |
\Symfony\Component\Console\Output\OutputInterface | the interface for buffering output |
Return Value:
the status code resulting from the dispatched command
Retrieves configured PSR-4 namespaces from the composer configuration.
protected getPsr4Namespaces(): arrayThis method SHALL parse the underlying composer.json using the Composer instance,
and MUST provide an empty array if no specific paths exist.
Return Value:
the PSR-4 namespaces mappings
Computes the human-readable title or description of the current application.
protected getProjectName(): stringThe method SHOULD utilize the package description as the title, but MUST provide the raw package name as a fallback mechanism.
Return Value:
the computed title or description string
Computes the human-readable description of the current application.
protected getProjectDescription(): stringThe method SHOULD utilize the package description as the title, but MUST provide the raw package name as a fallback mechanism.
Return Value:
the computed title or description string