| 1 | <?php |
||
| 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() |
||
| 85 | } |
||
| 86 |