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

EventBase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
getEventName() 0 1 ?
A getPayload() 0 4 1
A getDelivery() 0 4 1
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