Skip to content

MakeCommand

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

private array $errors

comments

private array $comments

info

private array $info

name

protected string $name

description

protected string $description

help

protected string $help

args

protected array $args

options

protected array $options

Methods

handle

public handle(): int

Inherited methods

__construct

public __construct(\Codefy\Framework\Application $codefy): mixed

Parameters:

Parameter Type Description
$codefy \Codefy\Framework\Application

configure

Configure commands.

protected configure(): void

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.

protected getArgument(string|null $key = null): mixed

Parameters:

Parameter Type Description
$key string|null

getOptions

Returns the option value for the given option name.

protected getOptions(string|null $key = null): bool|string|string[]

Parameters:

Parameter Type Description
$key string|null

terminalRaw

Outputs the string to the console without any tag.

protected terminalRaw(string $string): void

Parameters:

Parameter Type Description
$string string

terminalInfo

Output to the terminal wrap in info tags.

protected terminalInfo(string $string): void

Parameters:

Parameter Type Description
$string string

terminalComment

Output to the terminal wrap in comment tags.

protected terminalComment(string $string): void

Parameters:

Parameter Type Description
$string string

terminalQuestion

Output to the terminal wrap in question tags.

protected terminalQuestion(string $string): void

Parameters:

Parameter Type Description
$string string

terminalError

Output to the terminal wrap in error tags.

protected terminalError(string $string): void

Parameters:

Parameter Type Description
$string string

terminalNewLine

Output to the terminal with a blank line.

protected terminalNewLine(int $count = 1): void

Parameters:

Parameter Type Description
$count int

confirm

protected confirm(string $question): mixed

Parameters:

Parameter Type Description
$question string

ask

protected ask(string $question, bool|float|int|string|null $default = null): mixed

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

private resolveResource(string $resource, mixed $options): void

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

private addOptionalDirFlag(mixed $options): string

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.

private getStubFiles(string $classNameSuffix): string|false

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.

private resolveModelDependency(string $classNamePrefix, string $classNameSuffix): array|bool

Parameters:

Parameter Type Description
$classNamePrefix string
$classNameSuffix string


Automatically generated on 2025-10-13