Total Complexity | 5 |
Total Lines | 85 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
5 | class DiscordMessage |
||
6 | { |
||
7 | /** |
||
8 | * The text content of the message. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | public $body; |
||
13 | |||
14 | /** |
||
15 | * The embedded object attached to the message. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | public $embed; |
||
20 | |||
21 | /** |
||
22 | * The component objects attached to the message. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | public $components; |
||
27 | |||
28 | /** |
||
29 | * @param string $body |
||
30 | * @param array|null $embed |
||
31 | * |
||
32 | * @return static |
||
33 | */ |
||
34 | 1 | public static function create($body = '', $embed = [], $components = []) |
|
35 | { |
||
36 | 1 | return new static($body, $embed, $components); |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param string $body |
||
41 | * @param array $embed |
||
42 | */ |
||
43 | 4 | public function __construct($body = '', $embed = [], $components = []) |
|
44 | { |
||
45 | 4 | $this->body = $body; |
|
46 | 4 | $this->embed = $embed; |
|
47 | 4 | $this->components = $components; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * Set the text content of the message. |
||
52 | * |
||
53 | * @param string $body |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | 2 | public function body($body) |
|
58 | { |
||
59 | 2 | $this->body = $body; |
|
60 | |||
61 | 2 | return $this; |
|
62 | } |
||
63 | |||
64 | /** |
||
65 | * Set the embedded object. |
||
66 | * |
||
67 | * @param $embed |
||
68 | * |
||
69 | * @return $this |
||
70 | */ |
||
71 | 1 | public function embed($embed) |
|
76 | } |
||
77 | |||
78 | /** |
||
79 | * Set the components object. |
||
80 | * |
||
81 | * @param $components |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | 1 | public function components($components) |
|
90 | } |
||
91 | } |
||
92 |