8000 remove named arguments · symfony/symfony@159fd7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 159fd7e

Browse files
committed
remove named arguments
1 parent 9cf0cdf commit 159fd7e

File tree

3 files changed

+4
-42
lines changed

3 files changed

+4
-42
lines changed

src/Symfony/Component/Notifier/Bridge/Matrix/MatrixOptions.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ public function getRecipientId(): ?string
3333
return $this->options['recipient_id'] ?? null;
3434
}
3535

36-
public function getMsgType(): string
37-
{
38-
return $this->options['msgtype'] ?? 'm.text';
39-
}
40-
41-
public function getFormat(): ?string
42-
{
43-
return $this->options['format'] ?? null;
44-
}
45-
4636
public function jsonSerialize(): mixed
4737
{
4838
return $this->options;

src/Symfony/Component/Notifier/Bridge/Matrix/MatrixTransport.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,14 @@ protected function doSend(MessageInterface $message): SentMessage
8282
default => throw new UnsupportedRecipientTypeException(__CLASS__, mb_substr($message->getRecipientId(), 0, 1)),
8383
};
8484

85-
return $this->sendMessage($recipient, $message);
86-
}
87-
88-
protected function sendMessage(
89-
string $recipientId,
90-
MessageInterface $message,
91-
): SentMessage {
92-
/** @var MatrixOptions $options */
93-
$options = $message->getOptions();
94-
$uri = '/_matrix/client/v3/rooms/%s/send/%s/%s';
95-
96-
$content['msgtype'] = $options->getMsgType();
97-
if ('org.matrix.custom.html' === $options->getFormat()) {
98-
$content['format'] = $options->getFormat();
99-
$content['formatted_body'] = $message->getSubject();
100-
$content['body'] = strip_tags($message->getSubject());
85+
if ('org.matrix.custom.html' === $options['format']) {
86+
$options['formatted_body'] = $message->getSubject();
87+
$options['body'] = strip_tags($message->getSubject());
10188
} else {
10289
$content['body'] = $message->getSubject();
10390
}
10491

92+
$uri = '/_matrix/client/v3/rooms/%s/send/%s/%s';
10593
$response = $this->connect(
10694
method: 'PUT',
10795
uri: \sprintf($uri, $recipientId, 'm.room.message', Uuid::v4()),

src/Symfony/Component/Notifier/Bridge/Matrix/Tests/MatrixOptionsTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,6 @@ public function testGetRecipientId()
3434
$this->assertSame('@testuser:matrix.io', $options->getRecipientId());
3535
}
3636

37-
public function testGetMsgtype()
38-
{
39-
$options = new MatrixOptions([
40-
'msgtype' => 'm.text',
41-
]);
42-
$this->assertSame('m.text', $options->getMsgtype());
43-
}
44-
45-
public function testGetFormat()
46-
{
47-
$options = new MatrixOptions([
48-
'format' => 'org.matrix.custom.html',
49-
]);
50-
$this->assertSame('org.matrix.custom.html', $options->getFormat());
51-
}
52-
5337
public function testJsonSerialize()
5438
{
5539
$options = new MatrixOptions([

0 commit comments

Comments
 (0)
0