Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dda58cf

Browse filesBrowse files
pan93412OskarStarkfabpot
committed
Match current coding style
Co-authored-by: Oskar Stark <oskarstark@googlemail.com> Co-authored-by: fabpot <fabien@symfony.com>
1 parent 511fd38 commit dda58cf
Copy full SHA for dda58cf

File tree

3 files changed

+8
-7
lines changed
Filter options

3 files changed

+8
-7
lines changed

‎src/Symfony/Component/Notifier/Bridge/LineBot/LineBotTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/LineBot/LineBotTransport.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ protected function doSend(MessageInterface $message): SentMessage
6969
$originalContent = $message->getSubject();
7070

7171
$result = $response->toArray(false) ?: ['message' => ''];
72-
\assert(isset($result['message']) && \is_string($result['message']), "A LINE error response should contain a 'message' string key.");
72+
if (!isset($result['message']) || !\is_string($result['message'])) {
73+
$result['message'] = '';
74+
}
7375

7476
throw new TransportException(\sprintf('Unable to post the LINE message: "%s" (%d: "%s").', $originalContent, $statusCode, trim($result['message'])), $response);
7577
}

‎src/Symfony/Component/Notifier/Bridge/LineBot/LineBotTransportFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/LineBot/LineBotTransportFactory.php
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ public function create(Dsn $dsn): LineBotTransport
3434
throw new UnsupportedSchemeException($dsn, self::SCHEME, $this->getSupportedSchemes());
3535
}
3636

37-
$accessToken = $dsn->getUser();
38-
if (null === $accessToken) {
39-
throw new IncompleteDsnException('Missing channel access token.', 'linebot://'.$dsn->getHost());
40-
}
37+
$accessToken = $this->getUser($dsn);
4138
$receiver = $dsn->getRequiredOption('receiver');
42-
\assert(\is_string($receiver));
39+
if (!is_string($receiver)) {
40+
throw new \InvalidArgumentException('The "receiver" option must be a string.');
41+
}
4342

4443
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
4544
$port = $dsn->getPort();

‎src/Symfony/Component/Notifier/Bridge/LineBot/Tests/LineBotTransportFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/LineBot/Tests/LineBotTransportFactoryTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function createProvider(): iterable
5151

5252
public static function incompleteDsnProvider(): iterable
5353
{
54-
yield ['linebot://host.test?receiver=xxx', 'Missing channel access token.'];
54+
yield ['linebot://host.test?receiver=xxx', 'User is not set.'];
5555
}
5656

5757
public static function missingRequiredOptionProvider(): iterable

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.