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

EloquentSituationProvider::getForgetMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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