Skip to content

Commit 7cc6d29

Browse files
committed
fix: apply fabbot
1 parent 808dd2e commit 7cc6d29

File tree

7 files changed

+38
-25
lines changed

7 files changed

+38
-25
lines changed

src/Symfony/Component/Notifier/Bridge/Ntfy/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021-present Fabien Potencier
1+
Copyright (c) 2023-present Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/Notifier/Bridge/Ntfy/NtfyOptions.php

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
final class NtfyOptions implements MessageOptionsInterface
2121
{
2222
private array $options;
23-
const PRIORITY_MAX = 5;
24-
const PRIORITY_URGENT = 5;
25-
const PRIORITY_HIGH = 4;
26-
const PRIORITY_DEFAULT = 3;
27-
const PRIORITY_LOW = 2;
28-
const PRIORITY_MIN = 1;
23+
public const PRIORITY_MAX = 5;
24+
public const PRIORITY_URGENT = 5;
25+
public const PRIORITY_HIGH = 4;
26+
public const PRIORITY_DEFAULT = 3;
27+
public const PRIORITY_LOW = 2;
28+
public const PRIORITY_MIN = 1;
2929

3030
public function __construct(array $options = [])
3131
{
@@ -39,6 +39,7 @@ public static function fromNotification(Notification $notification): self
3939
$options->setMessage($notification->getContent());
4040
$options->setStringPriority($notification->getImportance());
4141
$options->addTag($notification->getEmoji());
42+
4243
return $options;
4344
}
4445

@@ -55,12 +56,14 @@ public function getRecipientId(): ?string
5556
public function setMessage(string $message): self
5657
{
5758
$this->options['message'] = $message;
59+
5860
return $this;
5961
}
6062

6163
public function setTitle(string $title): self
6264
{
6365
$this->options['title'] = $title;
66+
6467
return $this;
6568
}
6669

@@ -80,65 +83,75 @@ public function setStringPriority(string $priority): self
8083

8184
public function setPriority(int $priority): self
8285
{
83-
if (in_array($priority, [
84-
self::PRIORITY_MIN, self::PRIORITY_LOW, self::PRIORITY_DEFAULT, self::PRIORITY_HIGH, self::PRIORITY_URGENT, self::PRIORITY_MAX
86+
if (\in_array($priority, [
87+
self::PRIORITY_MIN, self::PRIORITY_LOW, self::PRIORITY_DEFAULT, self::PRIORITY_HIGH, self::PRIORITY_URGENT, self::PRIORITY_MAX,
8588
])) {
8689
$this->options['priority'] = $priority;
8790
}
91+
8892
return $this;
8993
}
9094

9195
public function addTag(string $tag): self
9296
{
9397
$this->options['tags'][] = $tag;
98+
9499
return $this;
95100
}
96101

97102
public function setTags(array $tags): self
98103
{
99104
$this->options['tags'] = $tags;
105+
100106
return $this;
101107
}
102108

103109
public function setDelay(\DateTimeInterface $dateTime): self
104110
{
105111
$this->options['delay'] = $dateTime->getTimestamp();
112+
106113
return $this;
107114
}
108115

109116
public function setActions(array $actions): self
110117
{
111118
$this->options['actions'] = $actions;
119+
112120
return $this;
113121
}
114122

115123
public function addAction(array $action): self
116124
{
117125
$this->options['actions'][] = $action;
126+
118127
return $this;
119128
}
120129

121130
public function setClick(string $url): self
122131
{
123132
$this->options['click'] = $url;
133+
124134
return $this;
125135
}
126136

127137
public function setAttachment(string $attachment): self
128138
{
129139
$this->options['attach'] = $attachment;
140+
130141
return $this;
131142
}
132143

133144
public function setFilename(string $filename): self
134145
{
135146
$this->options['filename'] = $filename;
147+
136148
return $this;
137149
}
138150

139151
public function setEmail(string $email): self
140152
{
141153
$this->options['email'] = $email;
154+
142155
return $this;
143156
}
144157

@@ -150,6 +163,7 @@ public function setCache(bool $enable)
150163
unset($this->options['cache']);
151164
}
152165
}
166+
153167
public function setFirebase(bool $enable)
154168
{
155169
if (!$enable) {

src/Symfony/Component/Notifier/Bridge/Ntfy/NtfyTransport.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,21 @@ public function isSecureHttp(): bool
5353
public function setSecureHttp(bool $secureHttp): self
5454
{
5555
$this->secureHttp = $secureHttp;
56+
5657
return $this;
5758
}
5859

5960
public function setPassword(?string $password): self
6061
{
6162
$this->password = $password;
63+
6264
return $this;
6365
}
6466

6567
public function setUser(?string $user): self
6668
{
6769
$this->user = $user;
70+
6871
return $this;
6972
}
7073

src/Symfony/Component/Notifier/Bridge/Ntfy/NtfyTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function create(Dsn $dsn): TransportInterface
3535
}
3636

3737
$secureHttp = $dsn->getOption('secureHttp', true);
38-
if (in_array($secureHttp, [0, false, 'false', 'off', 'no'])) {
38+
if (\in_array($secureHttp, [0, false, 'false', 'off', 'no'])) {
3939
$transport->setSecureHttp(false);
4040
}
4141

src/Symfony/Component/Notifier/Bridge/Ntfy/Tests/NtfyOptionsTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
/**
1818
* @author Mickael Perraud <mikaelkael.fr@gmail.com>
1919
*/
20-
2120
class NtfyOptionsTest extends TestCase
2221
{
23-
public function testNtfyOptions(): void
22+
public function testNtfyOptions()
2423
{
2524
$ntfyOptions = (new NtfyOptions())
2625
->setMessage('test message')

src/Symfony/Component/Notifier/Bridge/Ntfy/Tests/NtfyTransportFactoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
/**
1919
* @author Mickael Perraud <mikaelkael.fr@gmail.com>
2020
*/
21-
2221
final class NtfyTransportFactoryTest extends TransportFactoryTestCase
2322
{
24-
2523
public function createFactory(): TransportFactoryInterface
2624
{
2725
return new NtfyTransportFactory();

src/Symfony/Component/Notifier/Bridge/Ntfy/Tests/NtfyTransportTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
/**
2424
* @author Mickael Perraud <mikaelkael.fr@gmail.com>
2525
*/
26-
2726
final class NtfyTransportTest extends TransportTestCase
2827
{
2928
public static function createTransport(HttpClientInterface $client = null): NtfyTransport
@@ -47,33 +46,33 @@ public static function unsupportedMessagesProvider(): iterable
4746
yield [new DummyMessage()];
4847
}
4948

50-
public function testCanSetCustomHost(): void
49+
public function testCanSetCustomHost()
5150
{
5251
$transport = $this->createTransport();
5352
$transport->setHost($customHost = self::CUSTOM_HOST);
54-
$this->assertSame(\sprintf('ntfy://%s/test', $customHost), (string) $transport);
53+
$this->assertSame(sprintf('ntfy://%s/test', $customHost), (string) $transport);
5554
}
5655

57-
public function testCanSetCustomHostAndPort(): void
56+
public function testCanSetCustomHostAndPort()
5857
{
5958
$transport = $this->createTransport();
6059
$transport->setHost($customHost = self::CUSTOM_HOST);
6160
$transport->setPort($customPort = self::CUSTOM_PORT);
62-
$this->assertSame(\sprintf('ntfy://%s:%s/test', $customHost, $customPort), (string) $transport);
61+
$this->assertSame(sprintf('ntfy://%s:%s/test', $customHost, $customPort), (string) $transport);
6362
}
6463

65-
public function testSend(): void
64+
public function testSend()
6665
{
6766
$response = $this->createMock(ResponseInterface::class);
6867
$response->expects($this->exactly(2))
6968
->method('getStatusCode')
7069
->willReturn(200);
7170
$response->expects($this->once())
7271
->method('getContent')
73-
->willReturn(\json_encode(['id' => '2BYIwRmvBKcv', 'event' => 'message']));
72+
->willReturn(json_encode(['id' => '2BYIwRmvBKcv', 'event' => 'message']));
7473

7574
$client = new MockHttpClient(function (string $method, string $url, array $options = []) use ($response): ResponseInterface {
76-
$expectedBody = \json_encode(['topic' => 'test', 'title' => 'Hello', 'message' => 'World']);
75+
$expectedBody = json_encode(['topic' => 'test', 'title' => 'Hello', 'message' => 'World']);
7776
$this->assertJsonStringEqualsJsonString($expectedBody, $options['body']);
7877

7978
return $response;
@@ -86,18 +85,18 @@ public function testSend(): void
8685
$this->assertSame('2BYIwRmvBKcv', $sentMessage->getMessageId());
8786
}
8887

89-
public function testSendWithUserAndPassword(): void
88+
public function testSendWithUserAndPassword()
9089
{
9190
$response = $this->createMock(ResponseInterface::class);
9291
$response->expects($this->exactly(2))
9392
->method('getStatusCode')
9493
->willReturn(200);
9594
$response->expects($this->once())
9695
->method('getContent')
97-
->willReturn(\json_encode(['id' => '2BYIwRmvBKcv', 'event' => 'message']));
96+
->willReturn(json_encode(['id' => '2BYIwRmvBKcv', 'event' => 'message']));
9897

9998
$client = new MockHttpClient(function (string $method, string $url, array $options = []) use ($response): ResponseInterface {
100-
$expectedBody = \json_encode(['topic' => 'test', 'title' => 'Hello', 'message' => 'World']);
99+
$expectedBody = json_encode(['topic' => 'test', 'title' => 'Hello', 'message' => 'World']);
101100
$expectedAuthorization = 'Authorization: Basic dGVzdF91c2VyOnRlc3RfcGFzc3dvcmQ';
102101
$this->assertJsonStringEqualsJsonString($expectedBody, $options['body']);
103102
$this->assertTrue(\in_array($expectedAuthorization, $options['headers']));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy