LaravelMixpanelUserObserver   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 8
Bugs 1 Features 1
Metric Value
eloc 9
c 8
b 1
f 1
dl 0
loc 27
rs 10
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A restored() 0 4 2
A deleting() 0 4 2
A saving() 0 4 2
A created() 0 4 2
1
<?php namespace GeneaLabs\LaravelMixpanel\Listeners;
2
3
use GeneaLabs\LaravelMixpanel\Events\MixpanelEvent as Mixpanel;
4
5
class LaravelMixpanelUserObserver
6
{
7
    public function created($user)
8
    {
9
        if (config("services.mixpanel.enable-default-tracking")) {
10
            event(new Mixpanel($user, ['User: Registered' => []]));
11
        }
12
    }
13
14
    public function saving($user)
15
    {
16
        if (config("services.mixpanel.enable-default-tracking")) {
17
            event(new Mixpanel($user, ['User: Updated' => []]));
18
        }
19
    }
20
21
    public function deleting($user)
22
    {
23
        if (config("services.mixpanel.enable-default-tracking")) {
24
            event(new Mixpanel($user, ['User: Deactivated' => []]));
25
        }
26
    }
27
28
    public function restored($user)
29
    {
30
        if (config("services.mixpanel.enable-default-tracking")) {
31
            event(new Mixpanel($user, ['User: Reactivated' => []]));
32
        }
33
    }
34
}
35