@@ -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 | { |
@@ -100,7 +100,7 @@ |
||
100 | 100 | // see if the module has a registerComponents method |
101 | 101 | foreach ($module->registerComponents() as $componentId => $definition) { |
102 | 102 | if (!$app->has($componentId)) { |
103 | - Yii::trace('Register component ' . $componentId, __METHOD__); |
|
103 | + Yii::trace('Register component '.$componentId, __METHOD__); |
|
104 | 104 | $app->set($componentId, $definition); |
105 | 105 | } |
106 | 106 | } |
@@ -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) |
@@ -99,22 +99,22 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - $appModulesFolder = Yii::$app->basePath . DIRECTORY_SEPARATOR . 'modules'; |
|
103 | - $moduleFolder = $appModulesFolder . DIRECTORY_SEPARATOR . $moduleName; |
|
102 | + $appModulesFolder = Yii::$app->basePath.DIRECTORY_SEPARATOR.'modules'; |
|
103 | + $moduleFolder = $appModulesFolder.DIRECTORY_SEPARATOR.$moduleName; |
|
104 | 104 | |
105 | 105 | if (file_exists($moduleFolder)) { |
106 | - return $this->outputError("The folder " . $moduleFolder . " exists already."); |
|
106 | + return $this->outputError("The folder ".$moduleFolder." exists already."); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | $folders = [ |
110 | 110 | 'basePath' => $moduleFolder, |
111 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin', |
|
112 | - 'adminPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'aws', |
|
113 | - 'frontendPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend', |
|
114 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'blocks', |
|
115 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'controllers', |
|
116 | - 'blocksPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'views', |
|
117 | - 'modelsPath' => $moduleFolder . DIRECTORY_SEPARATOR . 'models', |
|
111 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin', |
|
112 | + 'adminPath' => $moduleFolder.DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR.'aws', |
|
113 | + 'frontendPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend', |
|
114 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'blocks', |
|
115 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'controllers', |
|
116 | + 'blocksPath' => $moduleFolder.DIRECTORY_SEPARATOR.'frontend'.DIRECTORY_SEPARATOR.'views', |
|
117 | + 'modelsPath' => $moduleFolder.DIRECTORY_SEPARATOR.'models', |
|
118 | 118 | ]; |
119 | 119 | |
120 | 120 | $ns = 'app\\modules\\'.$moduleName; |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | $contents = [ |
127 | - $moduleFolder. DIRECTORY_SEPARATOR . 'README.md' => $this->renderReadme($folders, $name, $ns), |
|
128 | - $moduleFolder. DIRECTORY_SEPARATOR . 'admin/Module.php' => $this->renderAdmin($folders, $name, $ns), |
|
129 | - $moduleFolder. DIRECTORY_SEPARATOR . 'frontend/Module.php' => $this->renderFrontend($folders, $name, $ns), |
|
127 | + $moduleFolder.DIRECTORY_SEPARATOR.'README.md' => $this->renderReadme($folders, $name, $ns), |
|
128 | + $moduleFolder.DIRECTORY_SEPARATOR.'admin/Module.php' => $this->renderAdmin($folders, $name, $ns), |
|
129 | + $moduleFolder.DIRECTORY_SEPARATOR.'frontend/Module.php' => $this->renderFrontend($folders, $name, $ns), |
|
130 | 130 | ]; |
131 | 131 | |
132 | 132 | foreach ($contents as $fileName => $content) { |
@@ -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'), |
@@ -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 |
@@ -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 | */ |