Skip to content

Commit

Permalink
Use title name for component descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
octoberapp committed Jun 13, 2024
1 parent 366d0a3 commit 7cddccf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Scaffold/Console/component/component.stub
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class {{studly_name}} extends ComponentBase
public function componentDetails()
{
return [
'name' => '{{name}} Component',
'name' => '{{title_name}} Component',
'description' => 'No description provided yet...'
];
}
Expand Down
16 changes: 4 additions & 12 deletions src/Scaffold/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,13 @@ public function makeStub(string $stubName)
$destinationFile = $this->getDestinationPath() . '/' . $this->stubs[$stubName];
$destinationContent = $this->files->get($sourceFile);

/*
* Parse each variable in to the destination content and path
*/
// Parse each variable in to the destination content and path
$destinationContent = Twig::parse($destinationContent, $this->vars);
$destinationFile = Twig::parse($destinationFile, $this->vars);

$this->makeDirectory($destinationFile);

/*
* Make sure this file does not already exist
*/
// Make sure this file does not already exist
if ($this->files->exists($destinationFile) && !$this->option('force')) {
throw new Exception('Stop everything!!! This file already exists: ' . $destinationFile);
}
Expand Down Expand Up @@ -125,9 +121,7 @@ protected function processVars(array $vars): array
$modifiers = ['plural', 'singular', 'title'];

foreach ($vars as $key => $var) {
/*
* Apply cases, and cases with modifiers
*/
// Apply cases, and cases with modifiers
foreach ($cases as $case) {
$primaryKey = $case . '_' . $key;
$vars[$primaryKey] = $this->modifyString($case, $var);
Expand All @@ -138,9 +132,7 @@ protected function processVars(array $vars): array
}
}

/*
* Apply modifiers
*/
// Apply modifiers
foreach ($modifiers as $modifier) {
$primaryKey = $modifier . '_' . $key;
$vars[$primaryKey] = $this->modifyString($modifier, $var);
Expand Down

0 comments on commit 7cddccf

Please sign in to comment.