Notification::getTrackers()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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
/**
14
 * Class Notification.
15
 */
16
class Notification implements FromArrayInterface
17
{
18
    /** @var string */
19
    private $event;
20
21
    /** @var array */
22
    private $trackers;
23
24
    /**
25
     * @param string $event
26
     * @param array  $trackers
27
     */
28
    public function __construct(string $event, array $trackers)
29
    {
30
        $this
31
            ->setEvent($event)
32
            ->setTrackers($trackers);
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getEvent()
39
    {
40
        return $this->event;
41
    }
42
43
    /**
44
     * @param string $event
45
     *
46
     * @return $this
47
     */
48
    public function setEvent(string $event)
49
    {
50
        $this->event = $event;
51
52
        return $this;
53
    }
54
55
    /**
56
     * @return array
57
     */
58
    public function getTrackers()
59
    {
60
        return $this->trackers;
61
    }
62
63
    /**
64
     * @param array $trackers
65
     *
66
     * @return $this
67
     */
68
    public function setTrackers(array $trackers)
69
    {
70
        $this->trackers = $trackers;
71
72
        return $this;
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    public static function fromArray(array $data)
79
    {
80
        return new static($data['event'], $data['trackers']);
81
    }
82
83
    /**
84
     * @return array
85
     */
86
    public function toArray()
87
    {
88
        return [
89
            'event' => $this->getEvent(),
90
            'trackers' => $this->getTrackers(),
91
        ];
92
    }
93
}
94