Skip to content

Commit 26ab126

Browse files
committed
Apply code formatting changes suggested by Style CI
1 parent 39c6372 commit 26ab126

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

src/Pushover.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class Pushover
4141
protected string $token;
4242

4343
/**
44-
* @param HttpClient $http
45-
* @param string $token
44+
* @param HttpClient $http
45+
* @param string $token
4646
*/
4747
public function __construct(HttpClient $http, string $token)
4848
{
@@ -56,8 +56,8 @@ public function __construct(HttpClient $http, string $token)
5656
*
5757
* @link https://pushover.net/api
5858
*
59-
* @param array $params
60-
* @param mixed $notifiable
59+
* @param array $params
60+
* @param mixed $notifiable
6161
* @return ResponseInterface
6262
*
6363
* @throws CouldNotSendNotification
@@ -106,7 +106,7 @@ public function send(array $params, mixed $notifiable): ResponseInterface
106106
/**
107107
* Merge token into parameters array, unless it has been set on the PushoverReceiver.
108108
*
109-
* @param array $params
109+
* @param array $params
110110
* @return array
111111
*/
112112
protected function paramsWithToken(array $params): array
@@ -122,8 +122,9 @@ protected function paramsWithToken(array $params): array
122122
* If there is any error (problem with reading the file, file size exceeds the limit, the file is not an image),
123123
* silently returns null and sends the message without image attachment.
124124
*
125-
* @param $file
125+
* @param $file
126126
* @return array|null
127+
*
127128
* @throws GuzzleException
128129
*/
129130
private function getImageData($file): ?array
@@ -151,7 +152,7 @@ private function getImageData($file): ?array
151152
}
152153

153154
// some servers may not return the "Content-Length" header
154-
$fileSizeChecked = (bool)$contentLength;
155+
$fileSizeChecked = (bool) $contentLength;
155156
}
156157

157158
// check if $file is an image
@@ -163,7 +164,7 @@ private function getImageData($file): ?array
163164

164165
$contents = file_get_contents($file);
165166
// if not checked before, finally check the file size after reading it
166-
if (!$fileSizeChecked && strlen($contents) > self::IMAGE_SIZE_LIMIT) {
167+
if (! $fileSizeChecked && strlen($contents) > self::IMAGE_SIZE_LIMIT) {
167168
return null;
168169
}
169170
} catch (Exception $exception) {

src/PushoverChannel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class PushoverChannel
1818
/**
1919
* Create a new Pushover channel instance.
2020
*
21-
* @param Pushover $pushover
22-
* @param Dispatcher $events
21+
* @param Pushover $pushover
22+
* @param Dispatcher $events
2323
*/
2424
public function __construct(Pushover $pushover, Dispatcher $events)
2525
{
@@ -30,8 +30,8 @@ public function __construct(Pushover $pushover, Dispatcher $events)
3030
/**
3131
* Send the given notification.
3232
*
33-
* @param mixed $notifiable
34-
* @param Notification $notification
33+
* @param mixed $notifiable
34+
* @param Notification $notification
3535
*
3636
* @throws CouldNotSendNotification
3737
* @throws GuzzleException

src/PushoverMessage.php

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class PushoverMessage
103103
public const EMERGENCY_PRIORITY = 2;
104104

105105
/**
106-
* @param string $content
106+
* @param string $content
107107
* @return static
108108
*/
109109
public static function create(string $content = ''): static
@@ -112,7 +112,7 @@ public static function create(string $content = ''): static
112112
}
113113

114114
/**
115-
* @param string $content
115+
* @param string $content
116116
*/
117117
public function __construct(string $content = '')
118118
{
@@ -122,7 +122,7 @@ public function __construct(string $content = '')
122122
/**
123123
* Set the content of the Pushover message.
124124
*
125-
* @param string $content
125+
* @param string $content
126126
* @return $this
127127
*/
128128
public function content(string $content): static
@@ -171,7 +171,7 @@ public function monospace(): static
171171
/**
172172
* Set the title of the Pushover message.
173173
*
174-
* @param string $title
174+
* @param string $title
175175
* @return $this
176176
*/
177177
public function title(string $title): static
@@ -184,13 +184,13 @@ public function title(string $title): static
184184
/**
185185
* Set the time of the Pushover message.
186186
*
187-
* @param int|Carbon $time
187+
* @param int|Carbon $time
188188
* @return $this
189189
*/
190190
public function time(int|Carbon $time): static
191191
{
192192
if ($time instanceof Carbon) {
193-
$time = (int)$time->timestamp;
193+
$time = (int) $time->timestamp;
194194
}
195195

196196
$this->timestamp = $time;
@@ -201,8 +201,8 @@ public function time(int|Carbon $time): static
201201
/**
202202
* Set a supplementary url for the Pushover message.
203203
*
204-
* @param string $url
205-
* @param string $title
204+
* @param string $url
205+
* @param string $title
206206
* @return $this
207207
*/
208208
public function url(string $url, string $title = ''): static
@@ -216,7 +216,7 @@ public function url(string $url, string $title = ''): static
216216
/**
217217
* Set the sound of the Pushover message.
218218
*
219-
* @param string $sound
219+
* @param string $sound
220220
* @return $this
221221
*/
222222
public function sound(string $sound): static
@@ -229,7 +229,7 @@ public function sound(string $sound): static
229229
/**
230230
* Set the image for attaching to the Pushover message. Either full or relative server path or a URL.
231231
*
232-
* @param string $image
232+
* @param string $image
233233
* @return $this
234234
*/
235235
public function image(string $image): static
@@ -243,10 +243,11 @@ public function image(string $image): static
243243
* Set the priority of the Pushover message.
244244
* Retry and expire are mandatory when setting the priority to emergency.
245245
*
246-
* @param int $priority
247-
* @param int|null $retryTimeout
248-
* @param int|null $expireAfter
246+
* @param int $priority
247+
* @param int|null $retryTimeout
248+
* @param int|null $expireAfter
249249
* @return $this
250+
*
250251
* @throws EmergencyNotificationRequiresRetryAndExpire
251252
*/
252253
public function priority(int $priority, int|null $retryTimeout = null, int|null $expireAfter = null): static
@@ -264,6 +265,7 @@ public function priority(int $priority, int|null $retryTimeout = null, int|null
264265
* Set the priority of the Pushover message to the lowest priority.
265266
*
266267
* @return $this
268+
*
267269
* @throws EmergencyNotificationRequiresRetryAndExpire
268270
*/
269271
public function lowestPriority(): static
@@ -275,6 +277,7 @@ public function lowestPriority(): static
275277
* Set the priority of the Pushover message to low.
276278
*
277279
* @return $this
280+
*
278281
* @throws EmergencyNotificationRequiresRetryAndExpire
279282
*/
280283
public function lowPriority(): static
@@ -286,6 +289,7 @@ public function lowPriority(): static
286289
* Set the priority of the Pushover message to normal.
287290
*
288291
* @return $this
292+
*
289293
* @throws EmergencyNotificationRequiresRetryAndExpire
290294
*/
291295
public function normalPriority(): static
@@ -297,6 +301,7 @@ public function normalPriority(): static
297301
* Set the priority of the Pushover message to high.
298302
*
299303
* @return $this
304+
*
300305
* @throws EmergencyNotificationRequiresRetryAndExpire
301306
*/
302307
public function highPriority(): static
@@ -308,9 +313,10 @@ public function highPriority(): static
308313
* Set the priority of the Pushover message to emergency.
309314
* Retry and expire are mandatory when setting the priority to emergency.
310315
*
311-
* @param int $retryTimeout
312-
* @param int $expireAfter
316+
* @param int $retryTimeout
317+
* @param int $expireAfter
313318
* @return $this
319+
*
314320
* @throws EmergencyNotificationRequiresRetryAndExpire
315321
*/
316322
public function emergencyPriority(int $retryTimeout, int $expireAfter): static
@@ -344,9 +350,9 @@ public function toArray(): array
344350
/**
345351
* Ensure an emergency message has an retry and expiry time.
346352
*
347-
* @param int $priority
348-
* @param int|null $retry
349-
* @param int|null $expire
353+
* @param int $priority
354+
* @param int|null $retry
355+
* @param int|null $expire
350356
*
351357
* @throws EmergencyNotificationRequiresRetryAndExpire
352358
*/

src/PushoverReceiver.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PushoverReceiver
1111
/**
1212
* PushoverReceiver constructor.
1313
*
14-
* @param string $key User or group key.
14+
* @param string $key User or group key.
1515
*/
1616
protected function __construct(string $key)
1717
{
@@ -21,7 +21,7 @@ protected function __construct(string $key)
2121
/**
2222
* Create new Pushover receiver with an user key.
2323
*
24-
* @param string $userKey Pushover user key.
24+
* @param string $userKey Pushover user key.
2525
* @return PushoverReceiver
2626
*/
2727
public static function withUserKey(string $userKey): PushoverReceiver
@@ -32,7 +32,7 @@ public static function withUserKey(string $userKey): PushoverReceiver
3232
/**
3333
* Create new Pushover receiver with a group key.
3434
*
35-
* @param string $groupKey Pushover group key.
35+
* @param string $groupKey Pushover group key.
3636
* @return PushoverReceiver
3737
*/
3838
public static function withGroupKey(string $groupKey): PushoverReceiver
@@ -45,24 +45,26 @@ public static function withGroupKey(string $groupKey): PushoverReceiver
4545
/**
4646
* Send the message to a specific device.
4747
*
48-
* @param array|string $device
48+
* @param array|string $device
4949
* @return PushoverReceiver
5050
*/
5151
public function toDevice(array|string $device): static
5252
{
5353
if (is_array($device)) {
5454
$this->devices = array_merge($device, $this->devices);
55+
5556
return $this;
5657
}
5758

5859
$this->devices[] = $device;
60+
5961
return $this;
6062
}
6163

6264
/**
6365
* Set the application token.
6466
*
65-
* @param $token
67+
* @param $token
6668
* @return PushoverReceiver
6769
*/
6870
public function withApplicationToken($token): static

tests/IntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function it_can_send_a_pushover_notification_with_an_overridden_token():
109109
protected function requestWillBeSentToPushoverWith($params): void
110110
{
111111
$multipartData = array_map(
112-
fn($key, $value) => ['name' => $key, 'contents' => $value],
112+
fn ($key, $value) => ['name' => $key, 'contents' => $value],
113113
array_keys($params),
114114
array_values($params)
115115
);

0 commit comments

Comments
 (0)