PolarMessage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 5
cbo 0
dl 0
loc 76
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
A body() 0 6 1
A status() 0 6 1
A from() 0 6 1
A url() 0 6 1
A extra() 0 6 1
1
<?php
2
3
namespace PolarAdmin\Polar\Notifications\Messages;
4
5
class PolarMessage
6
{
7
    /**
8
     * The notification body text.
9
     */
10
    public $body;
11
12
    /**
13
     * The status of the notification (info, success, warning, error).
14
     */
15
    public $status = 'info';
16
17
    /**
18
     * Name of the entity or user sending the message.
19
     */
20
    public $from = 'system';
21
22
    /**
23
     * The notification action url.
24
     */
25
    public $url;
26
27
    /**
28
     * Extra data.
29
     */
30
    public $extra = [];
31
32
    public function __construct(
33
        string $body = '',
34
        string $status = 'info',
35
        string $from = 'system',
36
        string $url = null,
37
        array $extra = []
38
    ) {
39
        $this->body = $body;
40
        $this->status = $status;
41
        $this->from = $from;
42
        $this->url = $url;
43
        $this->extra = $extra;
44
    }
45
46
    public function body(string $body) : self
47
    {
48
        $this->body = $body;
49
50
        return $this;
51
    }
52
53
    public function status(string $status) : self
54
    {
55
        $this->status = $status;
56
57
        return $this;
58
    }
59
60
    public function from(string $from) : self
61
    {
62
        $this->from = $from;
63
64
        return $this;
65
    }
66
67
    public function url(string $url) : self
68
    {
69
        $this->url = $url;
70
71
        return $this;
72
    }
73
74
    public function extra(array $extra) : self
75
    {
76
        $this->extra = $extra;
77
78
        return $this;
79
    }
80
}
81