| Conditions | 12 |
| Paths | 216 |
| Total Lines | 37 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 202 | public function getContentPaths($content = '') { |
||
| 203 | if (!$content) { |
||
| 204 | $content = $this->content; |
||
| 205 | } |
||
| 206 | $paths = []; |
||
| 207 | if ($this->module) { |
||
| 208 | if (\Inji\Controller::$cur) { |
||
| 209 | $paths['templateModuleController'] = $this->path . "/modules/{$this->module->name}/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 210 | } |
||
| 211 | $paths['templateModule'] = $this->path . "/modules/{$this->module->name}/{$content}.php"; |
||
| 212 | } |
||
| 213 | if (\Inji\Module::$cur) { |
||
| 214 | if (\Inji\Controller::$cur) { |
||
| 215 | $paths['templateCurModuleController'] = $this->path . "/modules/" . \Inji\Module::$cur->name . "/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 216 | } |
||
| 217 | $paths['templateCurModule'] = $this->path . "/modules/" . \Inji\Module::$cur->name . "/{$content}.php"; |
||
| 218 | } |
||
| 219 | if (\Inji\Controller::$cur) { |
||
| 220 | $modulePaths = \Inji\Module::getModulePaths(\Inji\Controller::$cur->module->name); |
||
| 221 | foreach ($modulePaths as $key => $modulePath) { |
||
| 222 | $paths['module_' . $key . '_appType'] = $modulePath . '/views/' . \Inji\Controller::$cur->module->app->type . '/' . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 223 | $paths['module_' . $key . '_appType_controllerName'] = $modulePath . '/views/' . \Inji\Controller::$cur->module->app->type . "/{$content}.php"; |
||
| 224 | $paths['module_' . $key] = $modulePath . '/views/' . "/{$content}.php"; |
||
| 225 | } |
||
| 226 | } |
||
| 227 | |||
| 228 | if ($this->module) { |
||
| 229 | if (\Inji\Controller::$cur) { |
||
| 230 | $paths['customModuleTemplateControllerContentController'] = $this->path . "/modules/" . $this->module->name . "/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 231 | } |
||
| 232 | $paths['customModuleTemplateControllerContent'] = $this->path . "/modules/" . $this->module->name . "/{$content}.php"; |
||
| 233 | } |
||
| 234 | if ($this->module && \Inji\Controller::$cur) { |
||
| 235 | $paths['customModuleControllerContentController'] = $this->module->path . '/' . \Inji\Controller::$cur->module->app->type . "Controllers/content/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 236 | $paths['customModuleControllerContent'] = $this->module->path . '/' . \Inji\Controller::$cur->module->app->type . "Controllers/content/{$content}.php"; |
||
| 237 | } |
||
| 238 | return $paths; |
||
| 239 | } |
||
| 265 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..