Completed
Push — master ( 14f2a3...e42cf7 )
by Iman
10:04
created

Forget::aboutAction()   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
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\HeyMan;
4
5
use Imanghafoori\HeyMan\Normilizers\ActionNormalizer;
6
use Imanghafoori\HeyMan\Normilizers\InputNormalizer;
7
use Imanghafoori\HeyMan\WatchingStrategies\{
8
    EloquentEventsManager, EventManager, RouterEventManager, ViewEventManager
9
};
10
11
class Forget
12
{
13
    use ActionNormalizer, InputNormalizer;
14
15
    /**
16
     * Forget constructor.
17 13
     */
18
    public function __construct()
19 13
    {
20
    }
21
22
    public function aboutView(...$view)
23
    {
24
        resolve(ViewEventManager::class)->forgetAbout($this->normalizeInput($view));
25 13
    }
26
27 13
    public function aboutSaving(...$model)
28
    {
29 4
        $this->forgetAboutModel($model, 'saving');
30
    }
31 4
32 4
    public function aboutDeleting(...$model)
33
    {
34 1
        $this->forgetAboutModel($model, 'deleting');
35
    }
36 1
37 1
    public function aboutFetching(...$model)
38
    {
39 1
        $this->forgetAboutModel($model, 'retrieved');
40
    }
41 1
42 1
    public function aboutCreating(...$model)
43
    {
44 1
        $this->forgetAboutModel($model, 'creating');
45
    }
46 1
47 1
    public function aboutUpdating(...$model)
48
    {
49
        $this->forgetAboutModel($model, 'updating');
50
    }
51
52
    public function aboutModel(...$model)
53
    {
54
        resolve(EloquentEventsManager::class)->forgetAbout($this->normalizeInput($model));
55
    }
56
57
    public function aboutEvent(...$events)
58
    {
59 1
        resolve(EventManager::class)->forgetAbout($this->normalizeInput($events));
60
    }
61 1
62 1
    public function aboutUrl(...$urls)
63
    {
64 2
        $this->forgetAboutRoute($this->normalizeUrl($urls, 'GET'));
65
    }
66 2
67 2
    public function aboutRoute(...$route)
68
    {
69 1
        $this->forgetAboutRoute($this->normalizeInput($route));
70
    }
71 1
72 1
    public function aboutAction(...$actions)
73
    {
74 1
        $this->forgetAboutRoute($this->normalizeAction($actions));
75
    }
76 1
77 1
    /**
78
     * @param $model
79 1
     * @param $event
80
     */
81 1
    private function forgetAboutModel($model, $event)
82 1
    {
83
        resolve(EloquentEventsManager::class)->forgetAbout($this->normalizeInput($model), $event);
84
    }
85
86
    /**
87
     * @param $normalizeUrl
88
     */
89
    private function forgetAboutRoute($normalizeUrl)
90 1
    {
91
        resolve(RouterEventManager::class)->forgetAbout($normalizeUrl);
92
    }
93
}
94