Completed
Push — master ( 431923...36feb4 )
by Sebastien
02:58
created

ModelBase   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A export() 0 6 1
A import() 0 4 1
A getRepository() 0 4 1
A getSender() 0 4 1
1
<?php
2
3
namespace Smalot\Github\Webhook\Model;
4
5
/**
6
 * Class ModelBase
7
 * @package Smalot\Github\Webhook\Model
8
 */
9
abstract class ModelBase
10
{
11
    /**
12
     * @var array
13
     */
14
    protected $payload;
15
16
    /**
17
     * EventBase constructor.
18
     * @param array $payload
19
     */
20
    public function __construct($payload)
21
    {
22
        $this->payload = $payload;
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function export()
29
    {
30
        return array(
31
            'payload' => $this->payload,
32
        );
33
    }
34
35
    /**
36
     * @param array $data
37
     */
38
    public function import($data)
39
    {
40
        $this->payload = $data['payload'];
41
    }
42
43
    /**
44
     * @return array
45
     */
46
    public function getRepository()
47
    {
48
        return $this->payload['repository'];
49
    }
50
51
    /**
52
     * @return array
53
     */
54
    public function getSender()
55
    {
56
        return $this->payload['sender'];
57
    }
58
}
59