Total Complexity | 7 |
Total Lines | 93 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Message implements \ArrayAccess |
||
8 | { |
||
9 | /** |
||
10 | * The title of the message. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | public $title; |
||
15 | /** |
||
16 | * The body of the message. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | public $message; |
||
21 | /** |
||
22 | * The message level. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | public $level = 'info'; |
||
27 | /** |
||
28 | * Whether the message should auto-hide. |
||
29 | * |
||
30 | * @var bool |
||
31 | */ |
||
32 | public $important = false; |
||
33 | /** |
||
34 | * Whether the message is an overlay. |
||
35 | * |
||
36 | * @var bool |
||
37 | */ |
||
38 | public $overlay = false; |
||
39 | /** |
||
40 | * Create a new message instance. |
||
41 | * |
||
42 | * @param array $attributes |
||
43 | */ |
||
44 | public function __construct($attributes = []) |
||
47 | } |
||
48 | /** |
||
49 | * Update the attributes. |
||
50 | * |
||
51 | * @param array $attributes |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function update($attributes = []) |
||
55 | { |
||
56 | $attributes = array_filter($attributes); |
||
57 | foreach ($attributes as $key => $attribute) { |
||
58 | $this->$key = $attribute; |
||
59 | } |
||
60 | return $this; |
||
61 | } |
||
62 | /** |
||
63 | * Whether the given offset exists. |
||
64 | * |
||
65 | * @param mixed $offset |
||
66 | * @return bool |
||
67 | */ |
||
68 | public function offsetExists($offset) |
||
69 | { |
||
70 | return isset($this->$offset); |
||
71 | } |
||
72 | /** |
||
73 | * Fetch the offset. |
||
74 | * |
||
75 | * @param mixed $offset |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function offsetGet($offset) |
||
79 | { |
||
80 | return $this->$offset; |
||
81 | } |
||
82 | /** |
||
83 | * Assign the offset. |
||
84 | * |
||
85 | * @param mixed $offset |
||
86 | * @return void |
||
87 | */ |
||
88 | public function offsetSet($offset, $value) |
||
91 | } |
||
92 | /** |
||
93 | * Unset the offset. |
||
94 | * |
||
95 | * @param mixed $offset |
||
96 | * @return void |
||
97 | */ |
||
98 | public function offsetUnset($offset) |
||
100 | // |
||
101 | } |
||
102 | } |