1 | <?php |
||
7 | class SlackMessage |
||
8 | { |
||
9 | /** |
||
10 | * The "level" of the notification (info, success, error). |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | public $level = 'info'; |
||
15 | |||
16 | /** |
||
17 | * The text content of the message. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | public $content; |
||
22 | |||
23 | /** |
||
24 | * The message's attachments. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | public $attachments = []; |
||
29 | |||
30 | /** |
||
31 | * Indicate that the notification gives information about a successful operation. |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function success() |
||
41 | |||
42 | /** |
||
43 | * Indicate that the notification gives information about an error. |
||
44 | * |
||
45 | * @return $this |
||
46 | */ |
||
47 | public function error() |
||
53 | |||
54 | /** |
||
55 | * Set the content of the Slack message. |
||
56 | * |
||
57 | * @param string $content |
||
58 | * @return $this |
||
59 | */ |
||
60 | 1 | public function content($content) |
|
66 | |||
67 | /** |
||
68 | * Define an attachment for the message. |
||
69 | * |
||
70 | * @param \Closure $callback |
||
71 | * @return $this |
||
72 | */ |
||
73 | 1 | public function attachment(Closure $callback) |
|
81 | |||
82 | /** |
||
83 | * Get the color for the message. |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | 1 | public function color() |
|
96 | } |
||
97 |