Completed
Push — master ( 4a7265...1250f4 )
by Freek
15:17
created

Message::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Flash;
4
5
class Message
6
{
7
    public string $message;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
8
9
    public ?string $class;
10
11
    public function __construct(string $message, $class = null)
12
    {
13
        if (is_array($class)) {
14
            $class = implode(' ', $class);
15
        }
16
17
        $this->message = $message;
18
19
        $this->class = $class;
20
    }
21
22
    public function toArray(): array
23
    {
24
        return [
25
            'message' => $this->message,
26
            'class' => $this->class,
27
        ];
28
    }
29
}
30