| 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 |
||
| 169 | public function getContentPaths($content = '') { |
||
| 170 | if (!$content) { |
||
| 171 | $content = $this->content; |
||
| 172 | } |
||
| 173 | $paths = []; |
||
| 174 | if ($this->module) { |
||
| 175 | if (\Inji\Controller::$cur) { |
||
| 176 | $paths['templateModuleController'] = $this->path . "/modules/{$this->module->name}/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 177 | } |
||
| 178 | $paths['templateModule'] = $this->path . "/modules/{$this->module->name}/{$content}.php"; |
||
| 179 | } |
||
| 180 | if (\Inji\Module::$cur) { |
||
| 181 | if (\Inji\Controller::$cur) { |
||
| 182 | $paths['templateCurModuleController'] = $this->path . "/modules/" . \Inji\Module::$cur->name . "/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 183 | } |
||
| 184 | $paths['templateCurModule'] = $this->path . "/modules/" . \Inji\Module::$cur->name . "/{$content}.php"; |
||
| 185 | } |
||
| 186 | if (\Inji\Controller::$cur) { |
||
| 187 | $modulePaths = \Inji\Module::getModulePaths(\Inji\Controller::$cur->module->name); |
||
| 188 | foreach ($modulePaths as $key => $modulePath) { |
||
| 189 | $paths['module_' . $key . '_appType'] = $modulePath . '/views/' . \Inji\Controller::$cur->module->app->type . '/' . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 190 | $paths['module_' . $key . '_appType_controllerName'] = $modulePath . '/views/' . \Inji\Controller::$cur->module->app->type . "/{$content}.php"; |
||
| 191 | $paths['module_' . $key] = $modulePath . '/views/' . "/{$content}.php"; |
||
| 192 | } |
||
| 193 | } |
||
| 194 | |||
| 195 | if ($this->module) { |
||
| 196 | if (\Inji\Controller::$cur) { |
||
| 197 | $paths['customModuleTemplateControllerContentController'] = $this->path . "/modules/" . $this->module->name . "/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 198 | } |
||
| 199 | $paths['customModuleTemplateControllerContent'] = $this->path . "/modules/" . $this->module->name . "/{$content}.php"; |
||
| 200 | } |
||
| 201 | if ($this->module && \Inji\Controller::$cur) { |
||
| 202 | $paths['customModuleControllerContentController'] = $this->module->path . '/' . \Inji\Controller::$cur->module->app->type . "Controllers/content/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
| 203 | $paths['customModuleControllerContent'] = $this->module->path . '/' . \Inji\Controller::$cur->module->app->type . "Controllers/content/{$content}.php"; |
||
| 204 | } |
||
| 205 | return $paths; |
||
| 206 | } |
||
| 230 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.