Passed
Push — master ( 75f6ef...2d6bc8 )
by Siim
10:44
created

BaseMessage::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: siim
5
 * Date: 7.02.19
6
 * Time: 7:21
7
 */
8
9
namespace Sf4\Api\Notification;
10
11
class BaseMessage implements MessageInterface
12
{
13
    /** @var string $type */
14
    protected $type;
15
16
    /** @var string $message */
17
    protected $message;
18
19
    /** @var string $key */
20
    protected $key;
21
22
    public function __construct()
23
    {
24
        $this->setType(static::TYPE);
25
    }
26
27
    public function getType(): string
28
    {
29
        return $this->type;
30
    }
31
32
    public function getMessage(): string
33
    {
34
        return $this->message;
35
    }
36
37
    public function getKey(): string
38
    {
39
        return $this->key;
40
    }
41
42
    public function setType(string $type): void
43
    {
44
        $this->type = $type;
45
    }
46
47
    public function setMessage(string $message): void
48
    {
49
        $this->message = $message;
50
    }
51
52
    public function setKey(string $key): void
53
    {
54
        $this->key = $key;
55
    }
56
57
    public function toArray(): array
58
    {
59
        return [
60
            'type' => $this->getType(),
61
            'key' => $this->getKey(),
62
            'message' => $this->getMessage()
63
        ];
64
    }
65
}
66