Skip to content
PHP Ecosystem
Explore

DiffCommand

API reference › Scaffold › Console › Command › DiffCommand

final classPHPForge\Scaffold\Console\Command\DiffCommand
ExtendsAbstractScaffoldCommand » Symfony\Component\Console\Command\Command
Sourcesrc/Console/Command/DiffCommand.php

Shows what applying the provider would change in a tracked file, or in every tracked file, as a unified diff.

MethodDescriptionDefined by
configure() protectedDeclares the optional file argument and the --all and --exit-code options.DiffCommand
execute() protected finalValidates the input, resolves the project root and runs AbstractScaffoldCommand::handle().AbstractScaffoldCommand
handle() protectedRenders the diff of the given file, or of every file with --all.DiffCommand
validate() protectedReturns whether exactly one of file and --all is given.DiffCommand
protected function configure(): void

Declares the optional file argument and the --all and --exit-code options.

protected function handle(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out, string $projectRoot): int

Renders the diff of the given file, or of every file with --all.

Parameters

ParameterTypeDescription
$inputSymfony\Component\Console\Input\InputInterfaceInput with the file argument and the --all and --exit-code options.
$outPHPForge\Scaffold\Console\SymfonyOutputWriterOutput sink that receives the diff and the error messages.
$projectRootstringAbsolute path of the project root.

Returns

int: Exit code of DiffService::run().

protected function validate(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out): bool

Returns whether exactly one of file and --all is given.

Parameters

ParameterTypeDescription
$inputSymfony\Component\Console\Input\InputInterfaceInput with the file argument and the --all option.
$outPHPForge\Scaffold\Console\SymfonyOutputWriterOutput sink that receives the error message.

Returns

bool: true when exactly one target is given, false otherwise.