AbstractScaffoldCommand
API reference › Scaffold › Console › Command › AbstractScaffoldCommand
7 subclasses
Runs a scaffold console command: validates its input, resolves the project root and reports a
RuntimeException of the command body as a [scaffold] error.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
execute() protected final | Validates the input, resolves the project root and runs AbstractScaffoldCommand::handle(). | AbstractScaffoldCommand |
handle() protected abstract | Runs the command body against the project root and returns its exit code. | AbstractScaffoldCommand |
validate() protected | Returns whether the input is valid, writing the error to the error output when it is not. | AbstractScaffoldCommand |
Method details
Section titled “Method details”execute()
Section titled “execute() ”final protected function execute(Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output): intValidates the input, resolves the project root and runs AbstractScaffoldCommand::handle().
Parameters
| Parameter | Type | Description |
|---|---|---|
$input | Symfony\ | Command input that may carry the global --working-dir option. |
$output | Symfony\ | Console output that receives the command output and the error messages. |
Returns
int: Exit code of AbstractScaffoldCommand::handle(); 1 when the project root is not found or a runtime error is reported; 2 when the input is invalid.
handle()
Section titled “handle() ”abstract protected function handle(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out, string $projectRoot): intRuns the command body against the project root and returns its exit code.
Parameters
| Parameter | Type | Description |
|---|---|---|
$input | Symfony\ | Command input. |
$out | PHPForge\ | Output sink of the command. |
$projectRoot | string | Absolute path of the directory containing the project composer.json. |
Returns
int: Exit code of the command.
Throws
RuntimeException: when the lock file or the project manifest cannot be read or written.
validate()
Section titled “validate() ”protected function validate(Symfony\Component\Console\Input\InputInterface $input, PHPForge\Scaffold\Console\SymfonyOutputWriter $out): boolReturns whether the input is valid, writing the error to the error output when it is not.
Parameters
| Parameter | Type | Description |
|---|---|---|
$input | Symfony\ | Command input. |
$out | PHPForge\ | Output sink that receives the error message. |
Returns
bool: true when the command may run, false otherwise.