8000 [Notifier] Fix ContactEveryoneOptions · symfony/symfony@8dd9d93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8dd9d93

Browse files
[Notifier] Fix ContactEveryoneOptions
1 parent 5bab536 commit 8dd9d93

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneOptions.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
/**
1717
* @author gnito-org <https://github.com/gnito-org>
18+
*
19+
* @see https://ceo-be.multimediabs.com/attachments/hosted/lightApiManualsFR
1820
*/
1921
final class ContactEveryoneOptions implements MessageOptionsInterface
2022
{
@@ -35,7 +37,7 @@ public function getRecipientId(): ?string
3537
*/
3638
public function diffusionName(string $diffusionName): static
3739
{
38-
$this->options['diffusion_name'] = $diffusionName;
40+
$this->options['diffusionname'] = $diffusionName;
3941

4042
return $this;
4143
}
@@ -50,6 +52,28 @@ public function category(string $category): static
5052
return $this;
5153
}
5254

55+
/**
56+
* @param 'fr_FR'|'en_GB' $locale
57+
*
58+
* @return $this
59+
*/
60+
public function locale(string $locale): static
61+
{
62+
$this->options['locale'] = $locale;
63+
64+
return $this;
65+
}
66+
67+
/**
68+
* @return $this
69+
*/
70+
public function unicode(bool $unicode): static
71+
{
72+
$this->options['xcharset'] = $unicode ? 'true' : 'false';
73+
74+
return $this;
75+
}
76+
5377
public function toArray(): array
5478
{
5579
return $this->options;

src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneTransport.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ protected function doSend(MessageInterface $message): SentMessage
7373
}
7474

7575
$options = $message->getOptions()?->toArray() ?? [];
76-
$options['xcharset'] = 'true';
76+
$options['category'] ??= $this->category;
77+
$options['diffusionname'] ??= $this->diffusionName;
78+
$options['xcharset'] ??= 'true';
7779
$options['token'] = $this->token;
7880
$options['to'] = $message->getPhone();
7981
$options['msg'] = $message->getSubject();

src/Symfony/Component/Notifier/Bridge/ContactEveryone/Tests/ContactEveryoneOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testContactEveryoneOptions()
2424

2525
self::assertSame([
2626
'category' => 'test_category',
27-
'diffusion_name' => 'test_diffusion_name',
27+
'diffusionname' => 'test_diffusion_name',
2828
], $contactEveryoneOptions->toArray());
2929
}
3030
}

0 commit comments

Comments
 (0)
0