| Conditions | 10 |
| Paths | 10 |
| Total Lines | 34 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 |
||
| 9 | public function index(bool $executeActions = true): bool |
||
| 10 | { |
||
| 11 | switch ($this->action) { |
||
| 12 | case 'logina': |
||
| 13 | $this->template = 'theme/adminlte/auth/login'; |
||
| 14 | break; |
||
| 15 | case 'loginm': |
||
| 16 | $this->template = 'theme/md/auth/login'; |
||
| 17 | break; |
||
| 18 | case 'logine': |
||
| 19 | $this->template = 'theme/eldy/auth/login'; |
||
| 20 | break; |
||
| 21 | case 'lista': |
||
| 22 | $this->template = 'theme/adminlte/page/adherent/type_list'; |
||
| 23 | break; |
||
| 24 | case 'listm': |
||
| 25 | $this->template = 'theme/md/page/adherent/type_list'; |
||
| 26 | break; |
||
| 27 | case 'liste': |
||
| 28 | $this->template = 'theme/eldy/page/adherent/type_list'; |
||
| 29 | break; |
||
| 30 | case 'edita': |
||
| 31 | $this->template = 'theme/adminlte/page/adherent/type_edit'; |
||
| 32 | break; |
||
| 33 | case 'editm': |
||
| 34 | $this->template = 'theme/md/page/adherent/type_edit'; |
||
| 35 | break; |
||
| 36 | case 'edite': |
||
| 37 | $this->template = 'theme/md/page/adherent/type_edit'; |
||
| 38 | break; |
||
| 39 | // default: |
||
| 40 | // $this->template = 'page/adherent/type_edit'; |
||
| 41 | } |
||
| 42 | return parent::index(); |
||
| 43 | } |
||
| 45 |