Passed
Push — master ( 8a2fee...fcbd82 )
by Mike
02:46
created

Message   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 11

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getFrameworkAttribute() 0 4 2
A getTypeAttribute() 0 3 2
A getLevelAttribute() 0 3 2
A getMessageAttribute() 0 3 2
A getTitleAttribute() 0 3 2
A getAutoHideAttribute() 0 3 1
1
<?php namespace GeneaLabs\LaravelMessenger;
2
3
use Jenssegers\Model\Model;
4
5
class Message extends Model
6
{
7
    protected $appends = [
8
        'autoHide',
9
        'framework',
10
        'message',
11
        'level',
12
        'title',
13
        'type',
14
    ];
15
    protected $casts = [
16
        'autoHide' => 'boolean',
17
    ];
18
    protected $fillable = [
19
        'autoHide',
20
        'framework',
21
        'message',
22
        'level',
23
        'title',
24
        'type',
25
    ];
26
27
    public function getAutoHideAttribute() : bool
28
    {
29
        return ($this->attributes['autoHide'] === true);
30
    }
31
32
    public function getFrameworkAttribute() : string
33
    {
34
        return $this->attributes['framework']
35
            ?: config('genealabs-laravel-messenger.framework');
36
    }
37
38
    public function getMessageAttribute() : string
39
    {
40
        return $this->attributes['message'] ?: '';
41
    }
42
43
    public function getLevelAttribute() : string
44
    {
45
        return $this->attributes['level'] ?: 'info';
46
    }
47
48
    public function getTitleAttribute() : string
49
    {
50
        return $this->attributes['title'] ?: '';
51
    }
52
53
    public function getTypeAttribute() : string
54
    {
55
        return $this->attributes['type'] ?: 'alert';
56
    }
57
}
58