| Total Complexity | 4 |
| Total Lines | 69 |
| Duplicated Lines | 0 % |
| Coverage | 50% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 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 |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Get body message |
||
| 72 | * |
||
| 73 | * @return mixed |
||
| 74 | */ |
||
| 75 | public function getBody() |
||
| 78 | } |
||
| 79 | } |