File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
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
}
Original file line number Diff line number Diff line change 3
3
namespace NotificationChannels \Pushbullet \Test ;
4
4
5
5
use NotificationChannels \Pushbullet \PushbulletMessage ;
6
+ use PHPUnit \Framework \TestCase ;
6
7
7
- class PushbulletMessageTest extends \PHPUnit_Framework_TestCase
8
+ class PushbulletMessageTest extends TestCase
8
9
{
9
10
/** @test */
10
11
public function message_can_be_instantiated_with_text ()
You can’t perform that action at this time.
0 commit comments