Completed
Push — master ( 9abbc7...a687e5 )
by Fabrizio
03:03
created

NotifynderEvent   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 3
Bugs 2 Features 1
Metric Value
wmc 7
c 3
b 2
f 1
lcom 1
cbo 0
dl 0
loc 76
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getNotifynderEvent() 0 4 1
A __construct() 0 6 1
A getEvent() 0 4 1
A get() 0 6 2
A getCategory() 0 4 1
A __get() 0 4 1
1
<?php
2
3
namespace Fenos\Notifynder\Handler;
4
5
use Fenos\Notifynder\Contracts\NotifyListener;
6
7
/**
8
 * Class NotifynderEvent.
9
 */
10
class NotifynderEvent implements NotifyListener
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $event;
16
17
    /**
18
     * @var array
19
     */
20
    protected $values;
21
22
    /**
23
     * @var string
24
     */
25
    protected $category;
26
27
    /**
28
     * @param       $event
29
     * @param       $category
30
     * @param array $values
31
     */
32
    public function __construct($event, $category = null, array $values = [])
33
    {
34
        $this->event = $event;
35
        $this->values = $values;
36
        $this->category = $category;
37
    }
38
39
    /**
40
     * @return mixed
41
     */
42
    public function getEvent()
43
    {
44
        return $this->event;
45
    }
46
47
    /**
48
     * Get a value from the given
49
     * values.
50
     *
51
     * @param $name
52
     * @return mixed
53
     */
54
    public function get($name)
55
    {
56
        if (array_key_exists($name, $this->values)) {
57
            return $this->values[$name];
58
        }
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function getCategory()
65
    {
66
        return $this->category;
67
    }
68
69
    /**
70
     * @param $name
71
     * @return mixed
72
     */
73
    public function __get($name)
74
    {
75
        return $this->get($name);
76
    }
77
78
    /**
79
     * @return NotifynderEvent
80
     */
81
    public function getNotifynderEvent()
82
    {
83
        return $this;
84
    }
85
}
86