From 7cddccf2f01204d185cb5c7c89b373d59c77c8b9 Mon Sep 17 00:00:00 2001 From: October CMS Date: Thu, 13 Jun 2024 14:00:21 +1000 Subject: [PATCH] Use title name for component descriptions --- src/Scaffold/Console/component/component.stub | 2 +- src/Scaffold/GeneratorCommand.php | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Scaffold/Console/component/component.stub b/src/Scaffold/Console/component/component.stub index 0165f89b6..e2204e0b3 100644 --- a/src/Scaffold/Console/component/component.stub +++ b/src/Scaffold/Console/component/component.stub @@ -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...' ]; } diff --git a/src/Scaffold/GeneratorCommand.php b/src/Scaffold/GeneratorCommand.php index 9c0b98637..26e7b86f0 100644 --- a/src/Scaffold/GeneratorCommand.php +++ b/src/Scaffold/GeneratorCommand.php @@ -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); } @@ -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); @@ -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);