MakeCommandAware
- Full name:
\Codefy\Framework\Console\Commands\Traits\MakeCommandAware
Methods
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