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

EloquentSituationProvider::getForgetArgs()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

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