SettingObserver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 6
Bugs 0 Features 1
Metric Value
wmc 2
c 6
b 0
f 1
lcom 0
cbo 0
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A saved() 0 6 1
A deleted() 0 4 1
1
<?php
2
3
namespace Merodiro\Settings\Observers;
4
5
use Illuminate\Support\Facades\Cache;
6
use Merodiro\Settings\Models\Setting;
7
8
class SettingObserver
9
{
10 40
    public function saved(Setting $setting)
11
    {
12 40
        $duration = config('settings.cache_duration');
13
14 40
        Cache::put($setting->cacheKey, $setting->value, $duration);
15 40
    }
16
17 8
    public function deleted(Setting $setting)
18
    {
19 8
        Cache::forget($setting->cacheKey);
20 8
    }
21
}
22