GeneratorCommand
- Full name:
\Codefy\Framework\Console\Commands\Domain\GeneratorCommand - Parent class:
\Codefy\Framework\Console\ConsoleCommand - This class is an Abstract class
Properties
type
The type of class being generated.
codefy
filesystem
Methods
__construct
public __construct(\Codefy\Framework\Application $codefy, \Qubus\FileSystem\FileSystem $filesystem): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$codefy | \Codefy\Framework\Application | |
$filesystem | \Qubus\FileSystem\FileSystem |
getStub
Get the stub file for the generator.
- This method is abstract.
handle
Throws:
qualifyClass
Parse the class name and format according to the root namespace.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$name | string |
Throws:
getDefaultNamespace
Get the default namespace for the class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$rootNamespace | string |
alreadyExists
Determine if the class already exists.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$rawName | string |
Throws:
getPath
Get the destination class path.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$name | string |
Throws:
makeDirectory
Build the directory for the class if necessary.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$path | string |
Throws:
buildClass
Build the class with the given name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$name | string |
Throws:
replaceNamespace
Replace the namespace for the given stub.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$stub | string | |
$name | string |
Throws:
getNamespace
Get the full namespace for a given class, without the class name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$name | string |
replaceClass
Replace the class name for the given stub.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$stub | string | |
$name | string |
sortImports
Alphabetically sorts the imports for the given stub.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$stub | string |
getNameInput
Get the desired class name from the input.
rootNamespace
Get the root namespace for the class.
Throws:
getArguments
Get the console command arguments.
promptForMissingArgumentsUsing
Prompt for missing input arguments using the returned questions.
Inherited methods
__construct
Parameters:
| Parameter | Type | Description |
|---|---|---|
$codefy | \Codefy\Framework\Application |
configure
Configure commands.
execute
protected execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output): int
Parameters:
| Parameter | Type | Description |
|---|---|---|
$input | \Symfony\Component\Console\Input\InputInterface | |
$output | \Symfony\Component\Console\Output\OutputInterface |
Throws:
getArgument
Returns the argument value for the given argument name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string|null |
getOptions
Returns the option value for the given option name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string|null |
terminalRaw
Outputs the string to the console without any tag.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$string | string |
terminalInfo
Output to the terminal wrap in info tags.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$string | string |
terminalComment
Output to the terminal wrap in comment tags.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$string | string |
terminalQuestion
Output to the terminal wrap in question tags.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$string | string |
terminalError
Output to the terminal wrap in error tags.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$string | string |
terminalNewLine
Output to the terminal with a blank line.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$count | int |
confirm
Parameters:
| Parameter | Type | Description |
|---|---|---|
$question | string |
ask
Parameters:
| Parameter | Type | Description |
|---|---|---|
$question | string | |
$default | bool|float|int|string|null |
choice
protected choice(string $question, (string|bool|int|float|\Stringable)[] $choices, bool|float|int|string|null $default = null, string|null $message = null): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$question | string | |
$choices | (string|bool|int|float|\Stringable)[] | |
$default | bool|float|int|string|null | |
$message | string|null |
multiChoice
protected multiChoice(string $question, (string|bool|int|float|\Stringable)[] $choices, bool|float|int|string|null $default = null, string|null $message = null): mixed
Parameters:
| Parameter | Type | Description |
|---|---|---|
$question | string | |
$choices | (string|bool|int|float|\Stringable)[] | |
$default | bool|float|int|string|null | |
$message | string|null |
resolveCommand
Resolve the console command instance for the given command.
protected resolveCommand(\Symfony\Component\Console\Command\Command|string $command): \Symfony\Component\Console\Command\Command
Parameters:
| Parameter | Type | Description |
|---|---|---|
$command | \Symfony\Component\Console\Command\Command|string |
call
Call another console command.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$command | \Symfony\Component\Console\Command\Command|string | |
$arguments | array |
Throws:
option
Get the value of a command option.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string|null |
options
Get all the options passed to the command.
runCommand
Run the given console command.
protected runCommand(\Symfony\Component\Console\Command\Command|string $command, array $arguments, \Symfony\Component\Console\Output\OutputInterface $output): int
Parameters:
| Parameter | Type | Description |
|---|---|---|
$command | \Symfony\Component\Console\Command\Command|string | |
$arguments | array | |
$output | \Symfony\Component\Console\Output\OutputInterface |
Throws:
createInputFromArguments
Create an input instance from the given arguments.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$arguments | array |
context
Get all the context passed to the command.