Passed
Push — master ( ead992...bbe860 )
by Бабичев
03:02
created

SettingService::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 4
dl 0
loc 6
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Bavix\Settings\Services;
4
5
use Bavix\Settings\Models\Setting;
6
use Bavix\Settings\Traits\HasSettings;
7
use Illuminate\Database\Eloquent\Model;
8
9
class SettingService
10
{
11
12
    /**
13
     * @param Model $model
14
     * @param string $key
15
     * @param string $cast
16
     * @param mixed $value
17
     * @return Setting
18
     */
19 12
    public function create(Model $model, string $key, string $cast, $value): Setting
20
    {
21
        /**
22
         * @var HasSettings $model
23
         */
24 12
        return $model->settings()->create(\compact('key', 'cast', 'value'));
25
    }
26
27
}
28