Completed
Pull Request — master (#3)
by Aymen
02:02
created

Event   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 79
c 0
b 0
f 0
wmc 8
lcom 0
cbo 0
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getMessage() 0 4 1
A setMessage() 0 4 1
A getTrackers() 0 4 1
A setTrackers() 0 4 1
A fromArray() 0 4 1
1
<?php
2
/**
3
 * This file is part of the fnayou/instapush-php project.
4
 *
5
 * Copyright (c) 2017. Aymen FNAYOU <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fnayou\InstapushPHP\Model;
12
13
use Fnayou\InstapushPHP\Model\FromArrayInterface;
14
15
/**
16
 * Model Event.
17
 */
18
class Event implements FromArrayInterface
19
{
20
    /** @var string */
21
    private $title;
22
23
    /** @var string */
24
    private $message;
25
26
    /** @var array */
27
    private $trackers;
28
29
    /**
30
     * @param string $title
31
     * @param string $message
32
     * @param array  $trackers
33
     */
34
    public function __construct(string $title, string $message, array $trackers)
35
    {
36
        $this->title = $title;
37
        $this->trackers = $trackers;
38
        $this->message = $message;
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getTitle()
45
    {
46
        return $this->title;
47
    }
48
49
    /**
50
     * @param string $title
51
     */
52
    public function setTitle(string $title)
53
    {
54
        $this->title = $title;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getMessage()
61
    {
62
        return $this->message;
63
    }
64
65
    /**
66
     * @param string $message
67
     */
68
    public function setMessage(string $message)
69
    {
70
        $this->message = $message;
71
    }
72
73
    /**
74
     * @return array
75
     */
76
    public function getTrackers()
77
    {
78
        return $this->trackers;
79
    }
80
81
    /**
82
     * @param array $trackers
83
     */
84
    public function setTrackers(array $trackers)
85
    {
86
        $this->trackers = $trackers;
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92
    public static function fromArray(array $data)
93
    {
94
        return new static($data['title'], $data['message'], $data['trackers']);
95
    }
96
}
97