Skip to content

Commit 702cde6

Browse files
committed
Prefix all sprintf() calls
1 parent 08d9b1f commit 702cde6

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

RemoteEvent/MailgunPayloadConverter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public function convert(array $payload): AbstractMailerEvent
4646
'unsubscribed' => MailerEngagementEvent::UNSUBSCRIBE,
4747
'opened' => MailerEngagementEvent::OPEN,
4848
'complained' => MailerEngagementEvent::SPAM,
49-
default => throw new ParseException(sprintf('Unsupported event "%s".', $payload['event'])),
49+
default => throw new ParseException(\sprintf('Unsupported event "%s".', $payload['event'])),
5050
};
5151
$event = new MailerEngagementEvent($name, $payload['id'], $payload);
5252
}
53-
if (!$date = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $payload['timestamp']))) {
54-
throw new ParseException(sprintf('Invalid date "%s".', sprintf('%.6F', $payload['timestamp'])));
53+
if (!$date = \DateTimeImmutable::createFromFormat('U.u', \sprintf('%.6F', $payload['timestamp']))) {
54+
throw new ParseException(\sprintf('Invalid date "%s".', \sprintf('%.6F', $payload['timestamp'])));
5555
}
5656
$event->setDate($date);
5757
$event->setRecipientEmail($payload['recipient']);

Transport/MailgunApiTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(
4646

4747
public function __toString(): string
4848
{
49-
return sprintf('mailgun+api://%s?domain=%s', $this->getEndpoint(), $this->domain);
49+
return \sprintf('mailgun+api://%s?domain=%s', $this->getEndpoint(), $this->domain);
5050
}
5151

5252
protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $envelope): ResponseInterface
@@ -57,7 +57,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
5757
$headers[] = $header->toString();
5858
}
5959

60-
$endpoint = sprintf('%s/v3/%s/messages', $this->getEndpoint(), urlencode($this->domain));
60+
$endpoint = \sprintf('%s/v3/%s/messages', $this->getEndpoint(), urlencode($this->domain));
6161
$response = $this->client->request('POST', 'https://'.$endpoint, [
6262
'auth_basic' => 'api:'.$this->key,
6363
'headers' => $headers,
@@ -68,13 +68,13 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
6868
$statusCode = $response->getStatusCode();
6969
$result = $response->toArray(false);
7070
} catch (DecodingExceptionInterface) {
71-
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).', $statusCode), $response);
71+
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).\sprintf(' (code %d).', $statusCode), $response);
7272
} catch (TransportExceptionInterface $e) {
7373
throw new HttpTransportException('Could not reach the remote Mailgun server.', $response, 0, $e);
7474
}
7575

7676
if (200 !== $statusCode) {
77-
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (code %d).', $statusCode), $response);
77+
throw new HttpTransportException('Unable to send an email: '.$result['message'].\sprintf(' (code %d).', $statusCode), $response);
7878
}
7979

8080
$sentMessage->setMessageId($result['id']);

Transport/MailgunHttpTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545

4646
public function __toString(): string
4747
{
48-
return sprintf('mailgun+https://%s?domain=%s', $this->getEndpoint(), $this->domain);
48+
return \sprintf('mailgun+https://%s?domain=%s', $this->getEndpoint(), $this->domain);
4949
}
5050

5151
protected function doSendHttp(SentMessage $message): ResponseInterface
@@ -59,7 +59,7 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
5959
$headers[] = $header->toString();
6060
}
6161

62-
$endpoint = sprintf('%s/v3/%s/messages.mime', $this->getEndpoint(), urlencode($this->domain));
62+
$endpoint = \sprintf('%s/v3/%s/messages.mime', $this->getEndpoint(), urlencode($this->domain));
6363
$response = $this->client->request('POST', 'https://'.$endpoint, [
6464
'auth_basic' => 'api:'.$this->key,
6565
'headers' => $headers,
@@ -70,13 +70,13 @@ protected function doSendHttp(SentMessage $message): ResponseInterface
7070
$statusCode = $response->getStatusCode();
7171
$result = $response->toArray(false);
7272
} catch (DecodingExceptionInterface) {
73-
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).', $statusCode), $response);
73+
throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).\sprintf(' (code %d).', $statusCode), $response);
7474
} catch (TransportExceptionInterface $e) {
7575
throw new HttpTransportException('Could not reach the remote Mailgun server.', $response, 0, $e);
7676
}
7777

7878
if (200 !== $statusCode) {
79-
throw new HttpTransportException('Unable to send an email: '.$result['message'].sprintf(' (code %d).', $statusCode), $response);
79+
throw new HttpTransportException('Unable to send an email: '.$result['message'].\sprintf(' (code %d).', $statusCode), $response);
8080
}
8181

8282
$message->setMessageId($result['id']);

Transport/MailgunSmtpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MailgunSmtpTransport extends EsmtpTransport
2424

2525
public function __construct(string $username, #[\SensitiveParameter] string $password, ?string $region = null, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
2626
{
27-
parent::__construct('us' !== ($region ?: 'us') ? sprintf('smtp.%s.mailgun.org', $region) : 'smtp.mailgun.org', 587, false, $dispatcher, $logger);
27+
parent::__construct('us' !== ($region ?: 'us') ? \sprintf('smtp.%s.mailgun.org', $region) : 'smtp.mailgun.org', 587, false, $dispatcher, $logger);
2828

2929
$this->setUsername($username);
3030
$this->setPassword($password);

0 commit comments

Comments
 (0)