| Conditions | 11 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 12 |
| 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 |
||
| 100 | public function getValueAttribute() |
||
| 101 | { |
||
| 102 | if ($this->getRawOriginal('setting_type') == 1 || $this->getRawOriginal('setting_type') == 10) { |
||
| 103 | return $this->string_value; |
||
| 104 | } elseif ($this->getRawOriginal('setting_type') == 2 || $this->getRawOriginal('setting_type') == 6 || $this->getRawOriginal('setting_type') == 7) { |
||
| 105 | return $this->integer_value; |
||
| 106 | } elseif ($this->getRawOriginal('setting_type') == 3 || $this->getRawOriginal('setting_type') == 4) { |
||
| 107 | return $this->text_value; |
||
| 108 | } elseif ($this->getRawOriginal('setting_type') == 5) { |
||
| 109 | return $this->boolean_value; |
||
| 110 | } elseif ($this->getRawOriginal('setting_type') == 8 || $this->getRawOriginal('setting_type') == 9) { |
||
| 111 | return $this->setting_json; |
||
| 112 | } else { |
||
| 113 | return null; |
||
| 114 | } |
||
| 117 |