Completed
Push — master ( 432495...dc645f )
by Iman
04:27
created

EloquentSituationProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 40
ccs 16
cts 16
cp 1
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getListener() 0 3 1
A getSituationProvider() 0 3 1
A getForgetKey() 0 3 1
A getForgetArgs() 0 8 2
A getMethods() 0 8 1
A getForgetMethods() 0 3 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\WatchingStrategies\EloquentModels;
4
5
class EloquentSituationProvider
6
{
7 116
    public function getListener()
8
    {
9 116
        return EloquentEventsListener::class;
10
    }
11
12 116
    public function getSituationProvider()
13
    {
14 116
        return EloquentSituations::class;
15
    }
16
17 116
    public function getForgetKey()
18
    {
19 116
        return 'eloquentChecks';
20
    }
21
22 14
    public static function getForgetMethods()
23
    {
24 14
        return ['aboutFetching', 'aboutSaving', 'aboutModel', 'aboutDeleting', 'aboutCreating', 'aboutUpdating'];
25
    }
26
27 5
    public static function getForgetArgs($method, $args)
28
    {
29 5
        $method = ltrim($method, 'about');
30 5
        $method = str_replace('Fetching', 'retrieved', $method);
31 5
        $method = strtolower($method);
32 5
        $method = $method == 'model' ? null : $method;
33
34 5
        return [EloquentEventsListener::class, $args, $method];
35
    }
36
37 116
    public function getMethods(): array
38
    {
39
        return [
40 116
            'whenYouFetch',
41
            'whenYouCreate',
42
            'whenYouUpdate',
43
            'whenYouSave',
44
            'whenYouDelete',
45
        ];
46
    }
47
}
48