Total Complexity | 10 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 43.75% |
Changes | 0 |
1 | <?php |
||
8 | class Message extends Model |
||
9 | { |
||
10 | protected $guarded = []; |
||
11 | |||
12 | protected $appends = [ |
||
13 | 'plaint_text', |
||
14 | 'time', |
||
15 | ]; |
||
16 | |||
17 | public function getTextAttribute() |
||
18 | { |
||
19 | if ($this->type == 'PLAIN') { |
||
|
|||
20 | return $this->messageData->msg->text; |
||
21 | } elseif ($this->type == 'RICH_CONTENT') { |
||
22 | return 'RICH_CONTENT'; |
||
23 | } else { |
||
24 | return isset($this->attributes['text']) ? $this->attributes['text'] : ''; |
||
25 | } |
||
26 | } |
||
27 | |||
28 | public function getPlainTextAttribute() |
||
31 | } |
||
32 | |||
33 | 2 | public function getTimeAttribute() |
|
34 | { |
||
35 | 2 | return new Carbon($this->attributes['time']); |
|
36 | } |
||
37 | |||
38 | 2 | public function __toString() |
|
46 | } |
||
47 | } |
||
49 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.