Conditions | 13 |
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 |
||
37 | public function getPaths($content = '') { |
||
38 | if (!$content) { |
||
39 | $content = $this->name; |
||
40 | } |
||
41 | $paths = []; |
||
42 | if ($this->page && $this->page->module) { |
||
43 | if (\Inji\Controller::$cur) { |
||
44 | $paths['templateModuleController'] = $this->path . "/modules/{$this->page->module->name}/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
45 | } |
||
46 | $paths['templateModule'] = $this->path . "/modules/{$this->page->module->name}/{$content}.php"; |
||
47 | } |
||
48 | if (\Inji\Module::$cur) { |
||
49 | if (\Inji\Controller::$cur) { |
||
50 | $paths['templateCurModuleController'] = $this->path . "/modules/" . \Inji\Module::$cur->name . "/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
51 | } |
||
52 | $paths['templateCurModule'] = $this->path . "/modules/" . \Inji\Module::$cur->name . "/{$content}.php"; |
||
53 | } |
||
54 | if (\Inji\Controller::$cur) { |
||
55 | $modulePaths = \Inji\Module::getModulePaths(\Inji\Controller::$cur->module->name); |
||
56 | foreach ($modulePaths as $key => $modulePath) { |
||
57 | $paths['module_' . $key . '_appType'] = $modulePath . '/views/' . \Inji\Controller::$cur->module->app->type . '/' . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
58 | $paths['module_' . $key . '_appType_controllerName'] = $modulePath . '/views/' . \Inji\Controller::$cur->module->app->type . "/{$content}.php"; |
||
59 | $paths['module_' . $key] = $modulePath . '/views/' . "/{$content}.php"; |
||
60 | } |
||
61 | } |
||
62 | |||
63 | if ($this->page->module) { |
||
64 | if (\Inji\Controller::$cur) { |
||
65 | $paths['customModuleTemplateControllerContentController'] = $this->path . "/modules/" . $this->page->module->name . "/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
66 | } |
||
67 | $paths['customModuleTemplateControllerContent'] = $this->path . "/modules/" . $this->page->module->name . "/{$content}.php"; |
||
68 | } |
||
69 | if ($this->page->module && \Inji\Controller::$cur) { |
||
70 | $paths['customModuleControllerContentController'] = $this->page->module->path . '/' . \Inji\Controller::$cur->module->app->type . "Controllers/content/" . \Inji\Controller::$cur->name . "/{$content}.php"; |
||
71 | $paths['customModuleControllerContent'] = $this->page->module->path . '/' . \Inji\Controller::$cur->module->app->type . "Controllers/content/{$content}.php"; |
||
72 | } |
||
73 | return $paths; |
||
74 | } |
||
75 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.