Completed
Push — master ( 7b141a...d4dccf )
by Sebastien
02:59
created

EventBase::getPayload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Smalot\Github\Webhook\Event;
4
5
/**
6
 * Class EventBase
7
 * @package Smalot\Github\Webhook\Event
8
 */
9
abstract class EventBase
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $eventName;
15
16
    /**
17
     * @var string
18
     */
19
    protected $payload;
20
21
    /**
22
     * @var string
23
     */
24
    protected $delivery;
25
26
    /**
27
     * EventBase constructor.
28
     * @param string $eventName
29
     * @param string $payload
30
     * @param string $delivery
31
     */
32
    public function __construct($eventName, $payload, $delivery = null)
33
    {
34
        $this->eventName = $eventName;
35
        $this->payload = json_decode($payload, true);
36
        $this->delivery = $delivery;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    abstract public function getEventName();
43
44
    /**
45
     * @return string
46
     */
47
    public function getPayload()
48
    {
49
        return $this->payload;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getDelivery()
56
    {
57
        return $this->delivery;
58
    }
59
}
60