@@ -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 | { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function getBasePath() |
137 | 137 | { |
138 | - return $this->getModule()->basePath; |
|
138 | + return $this->getModule()->basePath; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | private $_modelBasePath = null; |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function getModelBasePath() |
149 | 149 | { |
150 | - if ($this->_modelBasePath === null) { |
|
151 | - return $this->getModule()->basePath; |
|
152 | - } |
|
150 | + if ($this->_modelBasePath === null) { |
|
151 | + return $this->getModule()->basePath; |
|
152 | + } |
|
153 | 153 | |
154 | - return $this->_modelBasePath; |
|
154 | + return $this->_modelBasePath; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function setModelBasePath($path) |
158 | 158 | { |
159 | - $this->_modelBasePath = $path; |
|
159 | + $this->_modelBasePath = $path; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -169,23 +169,23 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function getNamespace() |
171 | 171 | { |
172 | - return $this->getModule()->getNamespace(); |
|
172 | + return $this->getModule()->getNamespace(); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | private $_modelNamespace = null; |
176 | 176 | |
177 | 177 | public function getModelNamespace() |
178 | 178 | { |
179 | - if ($this->_modelNamespace === null) { |
|
180 | - return $this->getModule()->getNamespace(); |
|
181 | - } |
|
179 | + if ($this->_modelNamespace === null) { |
|
180 | + return $this->getModule()->getNamespace(); |
|
181 | + } |
|
182 | 182 | |
183 | - return $this->_modelNamespace; |
|
183 | + return $this->_modelNamespace; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | public function setModelNamespace($ns) |
187 | 187 | { |
188 | - $this->_modelNamespace = $ns; |
|
188 | + $this->_modelNamespace = $ns; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | |
201 | 201 | public function ensureBasePathAndNamespace() |
202 | 202 | { |
203 | - $nsItems = explode('\\', $this->getNamespace()); |
|
204 | - // if there are more namespace paths then one, it means there is space for a sub folder models |
|
205 | - if (count($nsItems) > 1) { |
|
206 | - $items = explode(DIRECTORY_SEPARATOR, $this->getBasePath()); |
|
207 | - $last = array_pop($items); |
|
208 | - // as now we assume we change directory to a subfolder, the removed folder name must be "admin". |
|
209 | - if ($last == 'admin') { |
|
210 | - array_pop($nsItems); |
|
211 | - $this->modelNamespace = implode('\\', $nsItems); |
|
212 | - $this->modelBasePath = implode(DIRECTORY_SEPARATOR, $items); |
|
213 | - } |
|
214 | - } |
|
203 | + $nsItems = explode('\\', $this->getNamespace()); |
|
204 | + // if there are more namespace paths then one, it means there is space for a sub folder models |
|
205 | + if (count($nsItems) > 1) { |
|
206 | + $items = explode(DIRECTORY_SEPARATOR, $this->getBasePath()); |
|
207 | + $last = array_pop($items); |
|
208 | + // as now we assume we change directory to a subfolder, the removed folder name must be "admin". |
|
209 | + if ($last == 'admin') { |
|
210 | + array_pop($nsItems); |
|
211 | + $this->modelNamespace = implode('\\', $nsItems); |
|
212 | + $this->modelBasePath = implode(DIRECTORY_SEPARATOR, $items); |
|
213 | + } |
|
214 | + } |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $this->apiEndpoint, |
423 | 423 | $this->getDbTableShema(), |
424 | 424 | $this->enableI18n |
425 | - ), |
|
425 | + ), |
|
426 | 426 | ]; |
427 | 427 | |
428 | 428 | 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); |
@@ -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) |
@@ -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 | */ |
@@ -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) |