@@ -42,6 +42,11 @@ |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string|boolean $module |
|
| 47 | + * |
|
| 48 | + * @return string |
|
| 49 | + */ |
|
| 45 | 50 | private function getModuleMigrationDirectorie($module) |
| 46 | 51 | { |
| 47 | 52 | if (!array_key_exists($module, $this->moduleMigrationDirectories)) { |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | * @param string $search Search string to look for. |
| 48 | 48 | * @param string $replace Replacement value for the first found occurrence. |
| 49 | 49 | * @param string $subject The string you want to look up to replace the first element. |
| 50 | - * @return mixed Replaced string |
|
| 50 | + * @return string Replaced string |
|
| 51 | 51 | * @since 1.0.0-rc1 |
| 52 | 52 | */ |
| 53 | 53 | public static function replaceFirst($search, $replace, $subject) |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | /** |
| 46 | 46 | * Get the $moduleName without admin suffix (if any). |
| 47 | 47 | * |
| 48 | - * @return mixed Return the module name without admin suffix. |
|
| 48 | + * @return string Return the module name without admin suffix. |
|
| 49 | 49 | */ |
| 50 | 50 | public function getModuleNameWithoutAdminSuffix() |
| 51 | 51 | { |
@@ -170,13 +170,13 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function generateApiContent($fileNamespace, $className, $modelClass) |
| 172 | 172 | { |
| 173 | - $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 173 | + $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 174 | 174 | return $this->view->render('@luya/console/commands/views/crud/create_api.php', [ |
| 175 | 175 | 'namespace' => $fileNamespace, |
| 176 | 176 | 'className' => $className, |
| 177 | 177 | 'modelClass' => $modelClass, |
| 178 | 178 | 'luyaVersion' => $this->getGeneratorText('crud/create'), |
| 179 | - 'alias' => $alias, |
|
| 179 | + 'alias' => $alias, |
|
| 180 | 180 | ]); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function generateControllerContent($fileNamespace, $className, $modelClass) |
| 191 | 191 | { |
| 192 | - $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 192 | + $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 193 | 193 | return $this->view->render('@luya/console/commands/views/crud/create_controller.php', [ |
| 194 | 194 | 'namespace' => $fileNamespace, |
| 195 | 195 | 'className' => $className, |
| 196 | 196 | 'modelClass' => $modelClass, |
| 197 | 197 | 'luyaVersion' => $this->getGeneratorText('crud/create'), |
| 198 | - 'alias' => $alias, |
|
| 198 | + 'alias' => $alias, |
|
| 199 | 199 | ]); |
| 200 | 200 | } |
| 201 | 201 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function generateModelContent($fileNamepsace, $className, $apiEndpoint, TableSchema $schema, $i18nFields) |
| 213 | 213 | { |
| 214 | - $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 214 | + $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 215 | 215 | $dbTableName = $schema->fullName; |
| 216 | 216 | |
| 217 | 217 | $fields = []; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | 'properties' => $properties, |
| 260 | 260 | 'ngrestFieldConfig' => $ngrestFieldConfig, |
| 261 | 261 | 'i18nFields' => $i18nFields, |
| 262 | - 'alias' => $alias, |
|
| 262 | + 'alias' => $alias, |
|
| 263 | 263 | ]); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | $this->apiEndpoint, |
| 367 | 367 | $this->getDbTableShema(), |
| 368 | 368 | $this->enableI18n |
| 369 | - ), |
|
| 369 | + ), |
|
| 370 | 370 | ]; |
| 371 | 371 | |
| 372 | 372 | foreach ($files as $file) { |
@@ -397,7 +397,7 @@ |
||
| 397 | 397 | * |
| 398 | 398 | * @see ArrayAccess::offsetGet() |
| 399 | 399 | * @param string $offset The key to get from the array. |
| 400 | - * @return mixed The value for the offset key from the array. |
|
| 400 | + * @return string|boolean The value for the offset key from the array. |
|
| 401 | 401 | */ |
| 402 | 402 | public function offsetGet($offset) |
| 403 | 403 | { |
@@ -146,6 +146,11 @@ discard block |
||
| 146 | 146 | ]; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | + /** |
|
| 150 | + * @param string $type |
|
| 151 | + * @param string $varName |
|
| 152 | + * @param string $func |
|
| 153 | + */ |
|
| 149 | 154 | private function getExtraVarDef($type, $varName, $func) |
| 150 | 155 | { |
| 151 | 156 | $info = [ |
@@ -173,6 +178,9 @@ discard block |
||
| 173 | 178 | return false; |
| 174 | 179 | } |
| 175 | 180 | |
| 181 | + /** |
|
| 182 | + * @param string $type |
|
| 183 | + */ |
|
| 176 | 184 | private function getVariableTypeOption($type) |
| 177 | 185 | { |
| 178 | 186 | $types = $this->getVariableTypesOptions(); |
@@ -180,11 +188,17 @@ discard block |
||
| 180 | 188 | return $types[$type]; |
| 181 | 189 | } |
| 182 | 190 | |
| 191 | + /** |
|
| 192 | + * @param string $type |
|
| 193 | + */ |
|
| 183 | 194 | private function hasVariableTypeOption($type) |
| 184 | 195 | { |
| 185 | 196 | return array_key_exists($type, $this->getVariableTypesOptions()); |
| 186 | 197 | } |
| 187 | 198 | |
| 199 | + /** |
|
| 200 | + * @param string $prefix |
|
| 201 | + */ |
|
| 188 | 202 | private function placeholderCreator($prefix) |
| 189 | 203 | { |
| 190 | 204 | $this->output(PHP_EOL.'-> Create new '.$prefix, Console::FG_YELLOW); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | return $this->view->render('@luya/console/commands/views/block/create_block_view.php', [ |
| 285 | 285 | 'blockClassName' => $blockClassName, |
| 286 | 286 | 'phpdoc' => $this->viewFileDoc, |
| 287 | - 'luyaText' => $this->getGeneratorText('block/create'), |
|
| 287 | + 'luyaText' => $this->getGeneratorText('block/create'), |
|
| 288 | 288 | ]); |
| 289 | 289 | } |
| 290 | 290 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | 'config' => $this->config, |
| 381 | 381 | 'phpdoc' => $this->phpdoc, |
| 382 | 382 | 'extras' => $this->extras, |
| 383 | - 'luyaText' => $this->getGeneratorText('block/create'), |
|
| 383 | + 'luyaText' => $this->getGeneratorText('block/create'), |
|
| 384 | 384 | ]); |
| 385 | 385 | |
| 386 | 386 | if ($this->dryRun) { |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | * @param string $from |
| 44 | 44 | * @param string $to |
| 45 | 45 | * @param string $subject |
| 46 | - * @return mixed |
|
| 46 | + * @return string |
|
| 47 | 47 | * @since 1.0.0-rc1 |
| 48 | 48 | */ |
| 49 | 49 | public static function replaceFirst($from, $to, $subject) |
@@ -17,6 +17,7 @@ |
||
| 17 | 17 | /** |
| 18 | 18 | * Humanize the class name |
| 19 | 19 | * |
| 20 | + * @param string $name |
|
| 20 | 21 | * @return string The humanized name. |
| 21 | 22 | */ |
| 22 | 23 | public function humanizeName($name) |
@@ -14,70 +14,70 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class ModuleController extends \luya\console\Command |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Humanize the class name |
|
| 19 | - * |
|
| 20 | - * @return string The humanized name. |
|
| 21 | - */ |
|
| 22 | - public function humanizeName($name) |
|
| 23 | - { |
|
| 24 | - return $name = Inflector::humanize(Inflector::camel2words($name)); |
|
| 25 | - } |
|
| 17 | + /** |
|
| 18 | + * Humanize the class name |
|
| 19 | + * |
|
| 20 | + * @return string The humanized name. |
|
| 21 | + */ |
|
| 22 | + public function humanizeName($name) |
|
| 23 | + { |
|
| 24 | + return $name = Inflector::humanize(Inflector::camel2words($name)); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Render the readme template. |
|
| 29 | - * |
|
| 30 | - * @param string $folders |
|
| 31 | - * @param string $name |
|
| 32 | - * @param string $ns |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function renderReadme($folders, $name, $ns) |
|
| 36 | - { |
|
| 37 | - return $this->view->render('@luya/console/commands/views/module/readme.php', [ |
|
| 38 | - 'folders' => $folders, |
|
| 39 | - 'name' => $name, |
|
| 40 | - 'humanName' => $this->humanizeName($name), |
|
| 41 | - 'ns' => $ns, |
|
| 42 | - 'luyaText' => $this->getGeneratorText('module/create'), |
|
| 43 | - ]); |
|
| 44 | - } |
|
| 27 | + /** |
|
| 28 | + * Render the readme template. |
|
| 29 | + * |
|
| 30 | + * @param string $folders |
|
| 31 | + * @param string $name |
|
| 32 | + * @param string $ns |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function renderReadme($folders, $name, $ns) |
|
| 36 | + { |
|
| 37 | + return $this->view->render('@luya/console/commands/views/module/readme.php', [ |
|
| 38 | + 'folders' => $folders, |
|
| 39 | + 'name' => $name, |
|
| 40 | + 'humanName' => $this->humanizeName($name), |
|
| 41 | + 'ns' => $ns, |
|
| 42 | + 'luyaText' => $this->getGeneratorText('module/create'), |
|
| 43 | + ]); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Render the admin template. |
|
| 48 | - * |
|
| 49 | - * @param string $folders |
|
| 50 | - * @param string $name |
|
| 51 | - * @param string $ns |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 54 | - public function renderAdmin($folders, $name, $ns) |
|
| 55 | - { |
|
| 56 | - return $this->view->render('@luya/console/commands/views/module/adminmodule.php', [ |
|
| 57 | - 'folders' => $folders, |
|
| 58 | - 'name' => $this->humanizeName($name), |
|
| 59 | - 'ns' => $ns, |
|
| 60 | - 'luyaText' => $this->getGeneratorText('module/create'), |
|
| 61 | - ]); |
|
| 62 | - } |
|
| 46 | + /** |
|
| 47 | + * Render the admin template. |
|
| 48 | + * |
|
| 49 | + * @param string $folders |
|
| 50 | + * @param string $name |
|
| 51 | + * @param string $ns |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | + public function renderAdmin($folders, $name, $ns) |
|
| 55 | + { |
|
| 56 | + return $this->view->render('@luya/console/commands/views/module/adminmodule.php', [ |
|
| 57 | + 'folders' => $folders, |
|
| 58 | + 'name' => $this->humanizeName($name), |
|
| 59 | + 'ns' => $ns, |
|
| 60 | + 'luyaText' => $this->getGeneratorText('module/create'), |
|
| 61 | + ]); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Render the frontend template. |
|
| 66 | - * |
|
| 67 | - * @param string $folders |
|
| 68 | - * @param string $name |
|
| 69 | - * @param string $ns |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - public function renderFrontend($folders, $name, $ns) |
|
| 73 | - { |
|
| 74 | - return $this->view->render('@luya/console/commands/views/module/frontendmodule.php', [ |
|
| 75 | - 'folders' => $folders, |
|
| 76 | - 'name' => $this->humanizeName($name), |
|
| 77 | - 'ns' => $ns, |
|
| 78 | - 'luyaText' => $this->getGeneratorText('module/create'), |
|
| 79 | - ]); |
|
| 80 | - } |
|
| 64 | + /** |
|
| 65 | + * Render the frontend template. |
|
| 66 | + * |
|
| 67 | + * @param string $folders |
|
| 68 | + * @param string $name |
|
| 69 | + * @param string $ns |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + public function renderFrontend($folders, $name, $ns) |
|
| 73 | + { |
|
| 74 | + return $this->view->render('@luya/console/commands/views/module/frontendmodule.php', [ |
|
| 75 | + 'folders' => $folders, |
|
| 76 | + 'name' => $this->humanizeName($name), |
|
| 77 | + 'ns' => $ns, |
|
| 78 | + 'luyaText' => $this->getGeneratorText('module/create'), |
|
| 79 | + ]); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Create a new frontend/admin module. |
@@ -30,8 +30,8 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function renderWindowClassView($className, $namespace, $moduleId) |
| 32 | 32 | { |
| 33 | - $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 34 | - return $this->view->render('@luya/console/commands/views/aw/create.php', [ |
|
| 33 | + $alias = Inflector::humanize(Inflector::camel2words($className)); |
|
| 34 | + return $this->view->render('@luya/console/commands/views/aw/create.php', [ |
|
| 35 | 35 | 'className' => $className, |
| 36 | 36 | 'namespace' => $namespace, |
| 37 | 37 | 'luyaText' => $this->getGeneratorText('aw/create'), |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * Render the view file with its parameters. |
| 24 | 24 | * |
| 25 | 25 | * @param string $className |
| 26 | - * @param string $namepsace |
|
| 26 | + * @param string $namespace |
|
| 27 | 27 | * @param string $moduleId |
| 28 | 28 | * @return string |
| 29 | 29 | */ |
@@ -141,6 +141,6 @@ |
||
| 141 | 141 | */ |
| 142 | 142 | public function getGeneratorText($command) |
| 143 | 143 | { |
| 144 | - return 'File has been created with `'.$command.'` command on LUYA version '.$this->getLuyaVersion().'.'; |
|
| 144 | + return 'File has been created with `'.$command.'` command on LUYA version '.$this->getLuyaVersion().'.'; |
|
| 145 | 145 | } |
| 146 | 146 | } |