| Total Complexity | 5 |
| Total Lines | 88 |
| 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 = []) |
|
| 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) |
|
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Set a single embedded object. |
||
| 66 | * |
||
| 67 | * TODO: Refactor to enable multiple embeds. |
||
| 68 | * See https://discord.com/developers/docs/resources/channel#create-message |
||
| 69 | * |
||
| 70 | * @param array $embed |
||
| 71 | * |
||
| 72 | * @return $this |
||
| 73 | */ |
||
| 74 | 1 | public function embed($embed) |
|
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Set the components object. |
||
| 83 | * |
||
| 84 | * @param array $components |
||
| 85 | * |
||
| 86 | * @return $this |
||
| 87 | */ |
||
| 88 | 1 | public function components($components) |
|
| 95 |