@@ -55,11 +55,11 @@ |
||
55 | 55 | |
56 | 56 | $module = Yii::$app->getModule($moduleId); |
57 | 57 | |
58 | - $folder = $module->basePath . DIRECTORY_SEPARATOR . 'aws'; |
|
58 | + $folder = $module->basePath.DIRECTORY_SEPARATOR.'aws'; |
|
59 | 59 | |
60 | - $file = $folder . DIRECTORY_SEPARATOR . $className . '.php'; |
|
60 | + $file = $folder.DIRECTORY_SEPARATOR.$className.'.php'; |
|
61 | 61 | |
62 | - $content = $this->renderWindowClassView($className, $module->getNamespace() . '\\aws', $moduleId); |
|
62 | + $content = $this->renderWindowClassView($className, $module->getNamespace().'\\aws', $moduleId); |
|
63 | 63 | |
64 | 64 | FileHelper::createDirectory($folder); |
65 | 65 |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - $appModulesFolder = Yii::$app->basePath . DIRECTORY_SEPARATOR . 'modules'; |
|
104 | - $moduleFolder = $appModulesFolder . DIRECTORY_SEPARATOR . $moduleName; |
|
103 | + $appModulesFolder = Yii::$app->basePath.DIRECTORY_SEPARATOR.'modules'; |
|
104 | + $moduleFolder = $appModulesFolder.DIRECTORY_SEPARATOR.$moduleName; |
|
105 | 105 | |
106 | 106 | if (file_exists($moduleFolder)) { |
107 | - return $this->outputError("The folder " . $moduleFolder . " exists already."); |
|
107 | + return $this->outputError("The folder ".$moduleFolder." exists already."); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $folders = [ |
111 | 111 | 'basePath' => $moduleFolder, |
112 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin', |
|
113 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'aws', |
|
114 | - 'frontendPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend', |
|
115 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'blocks', |
|
116 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'controllers', |
|
117 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views', |
|
118 | - 'modelsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'models', |
|
112 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin', |
|
113 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'aws', |
|
114 | + 'frontendPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend', |
|
115 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'blocks', |
|
116 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'controllers', |
|
117 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'views', |
|
118 | + 'modelsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'models', |
|
119 | 119 | ]; |
120 | 120 | |
121 | 121 | $ns = 'app\\modules\\'.$moduleName; |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | $contents = [ |
128 | - $moduleFolder. DIRECTORY_SEPARATOR . 'README.md' => $this->renderReadme($folders, $moduleName, $ns), |
|
129 | - $moduleFolder. DIRECTORY_SEPARATOR . 'admin/Module.php' => $this->renderAdmin($folders, $moduleName, $ns), |
|
130 | - $moduleFolder. DIRECTORY_SEPARATOR . 'frontend/Module.php' => $this->renderFrontend($folders, $moduleName, $ns), |
|
128 | + $moduleFolder.DIRECTORY_SEPARATOR.'README.md' => $this->renderReadme($folders, $moduleName, $ns), |
|
129 | + $moduleFolder.DIRECTORY_SEPARATOR.'admin/Module.php' => $this->renderAdmin($folders, $moduleName, $ns), |
|
130 | + $moduleFolder.DIRECTORY_SEPARATOR.'frontend/Module.php' => $this->renderFrontend($folders, $moduleName, $ns), |
|
131 | 131 | ]; |
132 | 132 | |
133 | 133 | foreach ($contents as $fileName => $content) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getAbsoluteModelNamespace() |
81 | 81 | { |
82 | - return $this->getModelNamespace() . '\\models\\' . $this->getModelNameCamlized(); |
|
82 | + return $this->getModelNamespace().'\\models\\'.$this->getModelNameCamlized(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $sqlTable = $this->prompt('Database Table name for the Model:', ['required' => true, 'default' => $this->getDatabaseNameSuggestion()]); |
376 | 376 | if ($sqlTable == '?') { |
377 | 377 | foreach ($this->getSqlTablesArray() as $table) { |
378 | - $this->outputInfo("- " . $table); |
|
378 | + $this->outputInfo("- ".$table); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | if (isset($this->getSqlTablesArray()[$sqlTable])) { |
@@ -398,26 +398,26 @@ discard block |
||
398 | 398 | // api content |
399 | 399 | |
400 | 400 | $files['api'] = [ |
401 | - 'path' => $this->getBasePath() . DIRECTORY_SEPARATOR . 'apis', |
|
402 | - 'fileName' => $this->getModelNameCamlized() . 'Controller.php', |
|
403 | - 'content' => $this->generateApiContent($this->getNamespace() . '\\apis', $this->getModelNameCamlized() . 'Controller', $this->getAbsoluteModelNamespace()), |
|
401 | + 'path' => $this->getBasePath().DIRECTORY_SEPARATOR.'apis', |
|
402 | + 'fileName' => $this->getModelNameCamlized().'Controller.php', |
|
403 | + 'content' => $this->generateApiContent($this->getNamespace().'\\apis', $this->getModelNameCamlized().'Controller', $this->getAbsoluteModelNamespace()), |
|
404 | 404 | ]; |
405 | 405 | |
406 | 406 | // controller |
407 | 407 | |
408 | 408 | $files['controller'] = [ |
409 | - 'path' => $this->getBasePath() . DIRECTORY_SEPARATOR . 'controllers', |
|
410 | - 'fileName' => $this->getModelNameCamlized() . 'Controller.php', |
|
411 | - 'content' => $this->generateControllerContent($this->getNamespace() . '\\controllers', $this->getModelNameCamlized() . 'Controller', $this->getAbsoluteModelNamespace()), |
|
409 | + 'path' => $this->getBasePath().DIRECTORY_SEPARATOR.'controllers', |
|
410 | + 'fileName' => $this->getModelNameCamlized().'Controller.php', |
|
411 | + 'content' => $this->generateControllerContent($this->getNamespace().'\\controllers', $this->getModelNameCamlized().'Controller', $this->getAbsoluteModelNamespace()), |
|
412 | 412 | ]; |
413 | 413 | |
414 | 414 | // model |
415 | 415 | |
416 | 416 | $files['model'] = [ |
417 | - 'path' => $this->getModelBasePath() . DIRECTORY_SEPARATOR . 'models', |
|
418 | - 'fileName' => $this->getModelNameCamlized() . '.php', |
|
417 | + 'path' => $this->getModelBasePath().DIRECTORY_SEPARATOR.'models', |
|
418 | + 'fileName' => $this->getModelNameCamlized().'.php', |
|
419 | 419 | 'content' => $this->generateModelContent( |
420 | - $this->getModelNamespace() . '\\models', |
|
420 | + $this->getModelNamespace().'\\models', |
|
421 | 421 | $this->getModelNameCamlized(), |
422 | 422 | $this->apiEndpoint, |
423 | 423 | $this->getDbTableShema(), |
@@ -427,19 +427,19 @@ discard block |
||
427 | 427 | |
428 | 428 | foreach ($files as $file) { |
429 | 429 | FileHelper::createDirectory($file['path']); |
430 | - if (file_exists($file['path'] . DIRECTORY_SEPARATOR . $file['fileName'])) { |
|
430 | + if (file_exists($file['path'].DIRECTORY_SEPARATOR.$file['fileName'])) { |
|
431 | 431 | if (!$this->confirm("The File '{$file['fileName']}' already exists, do you want to override the existing file?")) { |
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | - if (FileHelper::writeFile($file['path'] . DIRECTORY_SEPARATOR . $file['fileName'], $file['content'])) { |
|
436 | + if (FileHelper::writeFile($file['path'].DIRECTORY_SEPARATOR.$file['fileName'], $file['content'])) { |
|
437 | 437 | $this->outputSuccess("Wrote file '{$file['fileName']}'."); |
438 | 438 | } else { |
439 | 439 | $this->outputError("Error while writing file '{$file['fileName']}'."); |
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
443 | - return $this->outputSuccess($this->generateBuildSummery($this->apiEndpoint, $this->getNamespace() . '\\apis\\' . $this->getModelNameCamlized() . 'Controller', $this->getModelNameCamlized(), $this->getSummaryControllerRoute())); |
|
443 | + return $this->outputSuccess($this->generateBuildSummery($this->apiEndpoint, $this->getNamespace().'\\apis\\'.$this->getModelNameCamlized().'Controller', $this->getModelNameCamlized(), $this->getSummaryControllerRoute())); |
|
444 | 444 | } |
445 | 445 | } |