Passed
Pull Request — master (#95)
by Fèvre
21:05 queued 16:05
created

SettingPresenter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A value() 0 5 1
1
<?php
2
3
namespace Xetaravel\Models\Presenters;
4
5
use Illuminate\Database\Eloquent\Casts\Attribute;
6
7
trait SettingPresenter
8
{
9
    /**
10
     * Accessor and mutator of the value.
11
     *
12
     * @return Attribute
13
     */
14
    public function value(): Attribute
15
    {
16
        return Attribute::make(
17
            get: fn (string $value) => unserialize($value),
18
            set: fn (mixed $value) => serialize($value),
19
        );
20
    }
21
}
22