| Conditions | 12 | 
| Paths | 10 | 
| Total Lines | 32 | 
| Code Lines | 21 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 7 | ||
| 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  | 
            ||
| 87 | protected function formattedValue($value)  | 
            ||
| 88 |     { | 
            ||
| 89 |         if ($this->format && is_string($this->format)) { | 
            ||
| 90 | return $this->formatter->format($value, $this->format);  | 
            ||
| 91 | }  | 
            ||
| 92 |         if ($this->format && is_callable($this->format)) { | 
            ||
| 93 | $value = call_user_func($this->format, $value);  | 
            ||
| 94 | return $value ?? $this->formatter->nullDisplay;  | 
            ||
| 95 | }  | 
            ||
| 96 |         if (null === $value) { | 
            ||
| 97 | return $this->formatter->nullDisplay;  | 
            ||
| 98 | }  | 
            ||
| 99 |         if (is_numeric($value)) { | 
            ||
| 100 | return $value;  | 
            ||
| 101 | }  | 
            ||
| 102 |         if (filter_var($value, FILTER_VALIDATE_URL)) { | 
            ||
| 103 | return Html::a(Html::encode($value), $value, ['target' => '_blank']);  | 
            ||
| 104 | }  | 
            ||
| 105 |         if (is_string($value)) { | 
            ||
| 106 |             if (empty($value)) { | 
            ||
| 107 | return $this->formatter->nullDisplay;  | 
            ||
| 108 | }  | 
            ||
| 109 | return $this->formatter->asNtext($value);  | 
            ||
| 110 | }  | 
            ||
| 111 |         if (is_bool($value)) { | 
            ||
| 112 | return $this->formatter->asBoolean($value);  | 
            ||
| 113 | }  | 
            ||
| 114 |         if (is_array($value)) { | 
            ||
| 115 | $value = json_encode($value, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);  | 
            ||
| 116 |             return Html::tag('pre', $value); | 
            ||
| 117 | }  | 
            ||
| 118 | return $value;  | 
            ||
| 119 | }  | 
            ||
| 129 |