Message::getBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 * Object data message
4
 */
5
6
namespace Asiries335\redisSteamPhp\Data;
7
8
9
final class Message implements DataInterface
10
{
11
    /**
12
     * Id message
13
     *
14
     * @var string
15
     */
16
    private $_id;
17
18
    /**
19
     * Key message
20
     *
21
     * @var string
22
     */
23
    private $_key;
24
25
    /**
26
     * Body message
27
     *
28
     * @var mixed
29
     */
30
    private $_body;
31
32
    /**
33
     * Message create
34
     *
35
     * @param array $data Data Message
36
     *
37
     * @return static
38
     */
39 1
    public static function create(array $data) : self
40
    {
41 1
        $message = new self();
42
43 1
        $message->_id   = $data[0] ?? null;
44 1
        $message->_key  = $data[1][0] ?? null;
45 1
        $message->_body = $data[1][1] ?? null;
46
47 1
        return $message;
48
    }
49
50
    /**
51
     * Get id message
52
     *
53
     * @return string
54
     */
55
    public function getId() : string
56
    {
57
        return $this->_id;
58
    }
59
60
    /**
61
     * Get key message
62
     *
63
     * @return string
64
     */
65
    public function getKey() : string
66
    {
67
        return $this->_key;
68
    }
69
70
    /**
71
     * Get body message
72
     *
73
     * @return mixed
74
     */
75
    public function getBody()
76
    {
77
        return $this->_body;
78
    }
79
}