File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -144,16 +144,31 @@ public function url($url)
144
144
public function toArray ()
145
145
{
146
146
$ payload = [
147
- 'target ' => $ this ->target ->getTarget (),
148
147
'type ' => $ this ->type ,
149
148
'title ' => $ this ->title ,
150
149
'body ' => $ this ->message ,
151
150
];
152
151
153
- if ($ this ->type === static ::TYPE_LINK ) {
154
- $ payload ['url ' ] = $ this ->url ;
155
- }
152
+ return array_merge (
153
+ $ payload ,
154
+ $ this ->target ->getTarget (),
155
+ $ this ->getUrlParameter ()
156
+ );
157
+ }
158
+
159
+ /**
160
+ * @return bool
161
+ */
162
+ private function isLink ()
163
+ {
164
+ return $ this ->type === static ::TYPE_LINK ;
165
+ }
156
166
157
- return $ payload ;
167
+ /**
168
+ * @return array
169
+ */
170
+ private function getUrlParameter ()
171
+ {
172
+ return $ this ->isLink () ? ['url ' => $ this ->url ] : [];
158
173
}
159
174
}
You can’t perform that action at this time.
0 commit comments