DiffCommand
API reference › Scaffold › Console › Command › DiffCommand
Shows what applying the provider would change in a tracked file, or in every tracked file, as a unified diff.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
configure() protected | Declares the optional file argument and the --all and --exit-code options. | DiffCommand |
execute() protected final | Validates the input, resolves the project root and runs AbstractScaffoldCommand::handle(). | AbstractScaffoldCommand |
handle() protected | Renders the diff of the given file, or of every file with --all. | DiffCommand |
validate() protected | Returns whether exactly one of file and --all is given. | DiffCommand |
Method details
Section titled “Method details”configure()
Section titled “configure() ”protected function configure(): voidDeclares the optional file argument and the --all and --exit-code options.
handle()
Section titled “handle() ”protected function handle(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out, string $projectRoot): intRenders the diff of the given file, or of every file with --all.
Parameters
| Parameter | Type | Description |
|---|---|---|
$input | Symfony\ | Input with the file argument and the --all and --exit-code options. |
$out | PHPForge\ | Output sink that receives the diff and the error messages. |
$projectRoot | string | Absolute path of the project root. |
Returns
int: Exit code of DiffService::run().
validate()
Section titled “validate() ”protected function validate(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out): boolReturns whether exactly one of file and --all is given.
Parameters
| Parameter | Type | Description |
|---|---|---|
$input | Symfony\ | Input with the file argument and the --all option. |
$out | PHPForge\ | Output sink that receives the error message. |
Returns
bool: true when exactly one target is given, false otherwise.