AbstractScaffoldCommand
extends AbstractBaseCommand
in package
This abstract class can be extended by commands to provide an easy way to create a bunch of files based on: 1. An array of stubFiles 2. A stubFolder where the stubFiles are located 3. A basePath in will files will be placed after string replacements 4. An array of string replacemens (searchStrings) in the format of search => replace
The replacements will be done both in file name and in file content. The same array will be used
Table of Contents
- $basePath : string
- Where files will be placed after replacements are done
- $files : Filesystem
- The Laravel Filesystem class, used to read and write files
- $searchStrings : array<string|int, mixed>
- The array of the replacements to be done, in the format search => replace
- $silent : bool
- Suppress all info,error,warn and printWelcome output messages use `$this->line` instead to force writing output in silent mode
- $stubFiles : array<string|int, mixed>
- The array that contains all the stubs files to be elavorated
- $stubFolder : string
- Where the stubs are located
- __construct() : mixed
- Check if basePath and stubFolder are provided, otherwise stop execution
- call() : int
- Call another console command.
- error() : void
- Print an <error>$string</error> message
- handle() : void
- Handles the command itself
- info() : void
- Print an <info>$string</info> message
- warn() : void
- Print an <error>$string</error> message
- printWelcome() : bool
- Prints a Welcome message
Properties
$basePath
Where files will be placed after replacements are done
protected
string
$basePath
$files
The Laravel Filesystem class, used to read and write files
protected
Filesystem
$files
$searchStrings
The array of the replacements to be done, in the format search => replace
protected
array<string|int, mixed>
$searchStrings
= []
$silent
Suppress all info,error,warn and printWelcome output messages use `$this->line` instead to force writing output in silent mode
protected
bool
$silent
= false
$stubFiles
The array that contains all the stubs files to be elavorated
protected
array<string|int, mixed>
$stubFiles
= []
$stubFolder
Where the stubs are located
protected
string
$stubFolder
Methods
__construct()
Check if basePath and stubFolder are provided, otherwise stop execution
public
__construct(Filesystem $files) : mixed
Parameters
- $files : Filesystem
Return values
mixed —call()
Call another console command.
public
call( $command[, array<string|int, mixed> $arguments = [] ]) : int
Parameters
Return values
int —error()
Print an <error>$string</error> message
public
error( $string[, $verbosity = null ]) : void
Parameters
Return values
void —handle()
Handles the command itself
public
handle() : void
Tags
Return values
void —info()
Print an <info>$string</info> message
public
info( $string[, $verbosity = null ]) : void
Parameters
Return values
void —warn()
Print an <error>$string</error> message
public
warn( $string[, $verbosity = null ]) : void
Parameters
Return values
void —printWelcome()
Prints a Welcome message
protected
printWelcome([string|null $message = null ][, bool $assumeYes = false ]) : bool
Parameters
- $message : string|null = null
- $assumeYes : bool = false