1
1
<?php
2
2
3
+ declare (strict_types=1 );
4
+
3
5
namespace NotificationChannels \Pushbullet ;
4
6
5
7
use NotificationChannels \Pushbullet \Targets \Targetable ;
6
8
7
9
class PushbulletMessage
8
10
{
9
- const TYPE_NOTE = 'note ' ;
10
- const TYPE_LINK = 'link ' ;
11
+ private const TYPE_NOTE = 'note ' ;
12
+ private const TYPE_LINK = 'link ' ;
11
13
12
14
/**
13
15
* Type of message (currently: note or link).
@@ -45,7 +47,7 @@ class PushbulletMessage
45
47
*
46
48
* @return static
47
49
*/
48
- public static function create ($ message )
50
+ public static function create ($ message ): self
49
51
{
50
52
return new static ($ message );
51
53
}
@@ -63,7 +65,7 @@ public function __construct($message)
63
65
*
64
66
* @return $this
65
67
*/
66
- public function target (Targetable $ targetable )
68
+ public function target (Targetable $ targetable ): self
67
69
{
68
70
$ this ->target = $ targetable ;
69
71
@@ -75,9 +77,9 @@ public function target(Targetable $targetable)
75
77
*
76
78
* @return $this
77
79
*/
78
- public function note ()
80
+ public function note (): self
79
81
{
80
- $ this ->type = static ::TYPE_NOTE ;
82
+ $ this ->type = self ::TYPE_NOTE ;
81
83
82
84
return $ this ;
83
85
}
@@ -87,9 +89,9 @@ public function note()
87
89
*
88
90
* @return $this
89
91
*/
90
- public function link ()
92
+ public function link (): self
91
93
{
92
- $ this ->type = static ::TYPE_LINK ;
94
+ $ this ->type = self ::TYPE_LINK ;
93
95
94
96
return $ this ;
95
97
}
@@ -101,7 +103,7 @@ public function link()
101
103
*
102
104
* @return $this
103
105
*/
104
- public function title ($ title )
106
+ public function title ($ title ): self
105
107
{
106
108
$ this ->title = $ title ;
107
109
@@ -115,7 +117,7 @@ public function title($title)
115
117
*
116
118
* @return $this
117
119
*/
118
- public function message ($ message )
120
+ public function message ($ message ): self
119
121
{
120
122
$ this ->message = $ message ;
121
123
@@ -129,7 +131,7 @@ public function message($message)
129
131
*
130
132
* @return $this
131
133
*/
132
- public function url ($ url )
134
+ public function url ($ url ): self
133
135
{
134
136
$ this ->url = $ url ;
135
137
@@ -141,7 +143,7 @@ public function url($url)
141
143
*
142
144
* @return array
143
145
*/
144
- public function toArray ()
146
+ public function toArray (): array
145
147
{
146
148
$ payload = [
147
149
'type ' => $ this ->type ,
@@ -159,15 +161,15 @@ public function toArray()
159
161
/**
160
162
* @return bool
161
163
*/
162
- private function isLink ()
164
+ private function isLink (): bool
163
165
{
164
- return $ this ->type === static ::TYPE_LINK ;
166
+ return $ this ->type === self ::TYPE_LINK ;
165
167
}
166
168
167
169
/**
168
170
* @return array
169
171
*/
170
- private function getUrlParameter ()
172
+ private function getUrlParameter (): array
171
173
{
172
174
return $ this ->isLink () ? ['url ' => $ this ->url ] : [];
173
175
}
0 commit comments