MakeCommand
- Full name:
\Codefy\Framework\Console\Commands\MakeCommand
- Parent class:
\Codefy\Framework\Console\ConsoleCommand
Constants
Constant | Visibility | Type | Value |
---|---|---|---|
FILE_EXTENSION | protected | '.php' | |
STUBS | private | ['controller' => 'App\Infrastructure\Http\Controllers', 'repository' => 'App\Infrastructure\Persistence\Repository', 'provider' => 'App\Infrastructure\Providers', 'middleware' => 'App\Infrastructure\Http\Middleware', 'error' => 'App\Infrastructure\Errors', 'command' => 'App\Application\Console\Commands', 'route' => 'App\Infrastructure\Http\Routes'] |
Properties
errors
comments
info
name
description
help
args
options
Methods
handle
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, array $choices, bool|float|int|string|null $default = null, string|null $message = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$question | string | |
$choices | array | |
$default | bool|float|int|string|null | |
$message | string|null |
multiChoice
protected multiChoice(string $question, array $choices, bool|float|int|string|null $default = null, string|null $message = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$question | string | |
$choices | array | |
$default | bool|float|int|string|null | |
$message | string|null |
resolveResource
Parameters:
Parameter | Type | Description |
---|---|---|
$resource | string | |
$options | mixed |
Throws:
resolveClassNameSuffix
private resolveClassNameSuffix(string $classNameSuffix, string $classNamePrefix, mixed|null $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$classNameSuffix | string | |
$classNamePrefix | string | |
$options | mixed|null |
Throws:
createClassFromStub
Create the class file based on the stub file. Once the file is resolved and have a valid directory path and the stub content is properly filtered and change to reflect. Then and only then we will generate the actual usable class file.
public createClassFromStub(string $qualifiedClass, string|null $contentStream = null, string|null $classNameSuffix = null, mixed|null $options = null, string|null $qualifiedNamespaces = null): void
Note. realpath will return false if the file or directory does not exist.
Parameters:
Parameter | Type | Description |
---|---|---|
$qualifiedClass | string | |
$contentStream | string|null | |
$classNameSuffix | string|null | |
$options | mixed|null | |
$qualifiedNamespaces | string|null | - will return the namespace for the stub command |
Throws:
addOptionalDirFlag
console command option flag. Use --dir={directory_name} to add a directory to the end of the filepath to create a subdirectory within a main directory
Parameters:
Parameter | Type | Description |
---|---|---|
$options | mixed |
getStubFiles
Uses the php glob to retrieve all stub files form the relevant directory. Which will return an array of files within the specified directory with the [.stub] extension.
We then iterate over that array and uses php str_contain function to match a file from the array with the classNameSuffix. When we have a match then return the matching file string.
Parameters:
Parameter | Type | Description |
---|---|---|
$classNameSuffix | string |
resolveStubContentPlaceholders
private resolveStubContentPlaceholders(string $file, string $classNameSuffix, string $classNamePrefix): array|bool
Parameters:
Parameter | Type | Description |
---|---|---|
$file | string | |
$classNameSuffix | string | |
$classNamePrefix | string |
resolveModelDependency
Resolve the model dependency by specifying which Stubs class will require a model.
Parameters:
Parameter | Type | Description |
---|---|---|
$classNamePrefix | string | |
$classNameSuffix | string |
Automatically generated on 2025-10-13