| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 4 | trait SettingPresenter |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * Attribute the value regardless to the type. |
||
| 8 | * |
||
| 9 | * @return int|bool|string |
||
| 10 | */ |
||
| 11 | public function getValueAttribute() |
||
| 12 | { |
||
| 13 | if (!is_null($this->value_int)) { |
||
| 14 | return intval($this->value_int); |
||
| 15 | } |
||
| 16 | |||
| 17 | if (!is_null($this->value_bool)) { |
||
| 18 | return boolval($this->value_bool); |
||
| 19 | } |
||
| 20 | |||
| 21 | if (!is_null($this->value_str)) { |
||
| 22 | return $this->value_str; |
||
| 23 | } |
||
| 24 | |||
| 25 | return null; |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get the type of the value. |
||
| 30 | * |
||
| 31 | * @return int|bool|string |
||
| 32 | */ |
||
| 33 | public function getTypeAttribute() |
||
| 48 | } |
||
| 49 | } |
||
| 50 |