Passed
Branch master (cd4548)
by Fèvre
19:36
created

SettingPresenter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 22
rs 10
c 1
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValueAttribute() 0 15 4
1
<?php
2
namespace Xetaravel\Models\Presenters;
3
4
use Xetaravel\Models\Setting;
5
6
trait SettingPresenter
7
{
8
    /**
9
     * Get the actual status of the server.
10
     *
11
     * @return int|bool|string
12
     */
13
    public function getValueAttribute()
14
    {
15
        if (!is_null($this->value_int)) {
16
            return intval($this->value_int);
17
        }
18
19
        if (!is_null($this->value_bool)) {
20
            return boolval($this->value_bool);
21
        }
22
23
        if (!is_null($this->value_str)) {
24
            return $this->value_str;
25
        }
26
27
        return null;
28
    }
29
}
30