Skip to content

Commit d75a40d

Browse files
OskarStarknicolas-grekas
authored andcommitted
[Mailer] [Bridges] Use CPP and add more #[\SensitiveParameter] attributes
1 parent b9c61b6 commit d75a40d

File tree

14 files changed

+108
-127
lines changed

14 files changed

+108
-127
lines changed

src/Symfony/Component/Mailer/Bridge/Amazon/Transport/SesHttpAsyncAwsTransport.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@
2828
*/
2929
class SesHttpAsyncAwsTransport extends AbstractTransport
3030
{
31-
protected SesClient $sesClient;
32-
33-
public function __construct(SesClient $sesClient, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
34-
{
35-
$this->sesClient = $sesClient;
36-
31+
public function __construct(
32+
protected SesClient $sesClient,
33+
EventDispatcherInterface $dispatcher = null,
34+
LoggerInterface $logger = null,
35+
) {
3736
parent::__construct($dispatcher, $logger);
3837
}
3938

src/Symfony/Component/Mailer/Bridge/Azure/Transport/AzureApiTransport.php

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,24 @@ final class AzureApiTransport extends AbstractApiTransport
2929
private const HOST = '%s.communication.azure.com';
3030

3131
/**
32-
* User Access Key from Azure Communication Service (Primary or Secondary key).
32+
* @param string $key User Access Key from Azure Communication Service (Primary or Secondary key)
33+
* @param string $resourceName The endpoint API URL to which to POST emails to Azure https://{acsResourceName}.communication.azure.com/
34+
* @param bool $disableTracking Indicates whether user engagement tracking should be disabled
35+
* @param string $apiVersion The version of API to invoke
3336
*/
34-
private string $key;
35-
36-
/**
37-
* The endpoint API URL to which to POST emails to Azure
38-
* https://{acsResourceName}.communication.azure.com/.
39-
*/
40-
private string $resourceName;
41-
42-
/**
43-
* The version of API to invoke.
44-
*/
45-
private string $apiVersion;
46-
47-
/**
48-
* Indicates whether user engagement tracking should be disabled.
49-
*/
50-
private bool $disableTracking;
51-
52-
public function __construct(string $key, string $resourceName, bool $disableTracking = false, string $apiVersion = '2023-03-31', HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
53-
{
37+
public function __construct(
38+
#[\SensitiveParameter] private string $key,
39+
private string $resourceName,
40+
private bool $disableTracking = false,
41+
private string $apiVersion = '2023-03-31',
42+
HttpClientInterface $client = null,
43+
EventDispatcherInterface $dispatcher = null,
44+
LoggerInterface $logger = null,
45+
) {
5446
if (str_contains($resourceName, '.') || str_ends_with($resourceName, '.')) {
5547
throw new \Exception('Resource name cannot contain or end with a dot.');
5648
}
5749

58-
$this->resourceName = $resourceName;
59-
$this->key = $key;
60-
$this->apiVersion = $apiVersion;
61-
$this->disableTracking = $disableTracking;
6250
parent::__construct($client, $dispatcher, $logger);
6351
}
6452

src/Symfony/Component/Mailer/Bridge/Brevo/Transport/BrevoApiTransport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
*/
3333
final class BrevoApiTransport extends AbstractApiTransport
3434
{
35-
private string $key;
36-
37-
public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
38-
{
39-
$this->key = $key;
40-
35+
public function __construct(
36+
#[\SensitiveParameter] private string $key,
37+
HttpClientInterface $client = null,
38+
EventDispatcherInterface $dispatcher = null,
39+
LoggerInterface $logger = null,
40+
) {
4141
parent::__construct($client, $dispatcher, $logger);
4242
}
4343

src/Symfony/Component/Mailer/Bridge/Infobip/Transport/InfobipApiTransport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ final class InfobipApiTransport extends AbstractApiTransport
4141
'X-Infobip-Track' => 'track',
4242
];
4343

44-
private string $key;
45-
46-
public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
47-
{
48-
$this->key = $key;
49-
44+
public function __construct(
45+
#[\SensitiveParameter] private string $key,
46+
HttpClientInterface $client = null,
47+
EventDispatcherInterface $dispatcher = null,
48+
LoggerInterface $logger = null,
49+
) {
5050
parent::__construct($client, $dispatcher, $logger);
5151
}
5252

src/Symfony/Component/Mailer/Bridge/MailPace/Transport/MailPaceApiTransport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ final class MailPaceApiTransport extends AbstractApiTransport
3131
{
3232
private const HOST = 'app.mailpace.com/api/v1';
3333

34-
private string $key;
35-
36-
public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
37-
{
38-
$this->key = $key;
39-
34+
public function __construct(
35+
#[\SensitiveParameter] private string $key,
36+
HttpClientInterface $client = null,
37+
EventDispatcherInterface $dispatcher = null,
38+
LoggerInterface $logger = null,
39+
) {
4040
parent::__construct($client, $dispatcher, $logger);
4141
}
4242

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillApiTransport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class MandrillApiTransport extends AbstractApiTransport
3232
{
3333
private const HOST = 'mandrillapp.com';
3434

35-
private string $key;
36-
37-
public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
38-
{
39-
$this->key = $key;
40-
35+
public function __construct(
36+
#[\SensitiveParameter] private string $key,
37+
HttpClientInterface $client = null,
38+
EventDispatcherInterface $dispatcher = null,
39+
LoggerInterface $logger = null,
40+
) {
4141
parent::__construct($client, $dispatcher, $logger);
4242
}
4343

src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ class MandrillHttpTransport extends AbstractHttpTransport
3030
use MandrillHeadersTrait;
3131

3232
private const HOST = 'mandrillapp.com';
33-
private string $key;
34-
35-
public function __construct(string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
36-
{
37-
$this->key = $key;
3833

34+
public function __construct(
35+
#[\SensitiveParameter] private string $key,
36+
HttpClientInterface $client = null,
37+
EventDispatcherInterface $dispatcher = null,
38+
LoggerInterface $logger = null,
39+
) {
3940
parent::__construct($client, $dispatcher, $logger);
4041
}
4142

src/Symfony/Component/Mailer/Bridge/MailerSend/Transport/MailerSendApiTransport.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
*/
3030
final class MailerSendApiTransport extends AbstractApiTransport
3131
{
32-
private string $key;
33-
34-
public function __construct(#[\SensitiveParameter] string $key, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
35-
{
36-
$this->key = $key;
37-
32+
public function __construct(
33+
#[\SensitiveParameter] private string $key,
34+
HttpClientInterface $client = null,
35+
EventDispatcherInterface $dispatcher = null,
36+
LoggerInterface $logger = null,
37+
) {
3838
parent::__construct($client, $dispatcher, $logger);
3939
}
4040

src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunApiTransport.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@ class MailgunApiTransport extends AbstractApiTransport
3333
{
3434
private const HOST = 'api.%region_dot%mailgun.net';
3535

36-
private string $key;
37-
private string $domain;
38-
private ?string $region;
39-
40-
public function __construct(string $key, string $domain, string $region = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
41-
{
42-
$this->key = $key;
43-
$this->domain = $domain;
44-
$this->region = $region;
45-
36+
public function __construct(
37+
#[\SensitiveParameter] private string $key,
38+
private string $domain,
39+
private ?string $region = null,
40+
HttpClientInterface $client = null,
41+
EventDispatcherInterface $dispatcher = null,
42+
LoggerInterface $logger = null,
43+
) {
4644
parent::__construct($client, $dispatcher, $logger);
4745
}
4846

src/Symfony/Component/Mailer/Bridge/Mailgun/Transport/MailgunHttpTransport.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ class MailgunHttpTransport extends AbstractHttpTransport
3232

3333
private const HOST = 'api.%region_dot%mailgun.net';
3434

35-
private string $key;
36-
private string $domain;
37-
private ?string $region;
38-
39-
public function __construct(string $key, string $domain, string $region = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
40-
{
41-
$this->key = $key;
42-
$this->domain = $domain;
43-
$this->region = $region;
44-
35+
public function __construct(
36+
#[\SensitiveParameter] private string $key,
37+
private string $domain,
38+
private ?string $region = null,
39+
HttpClientInterface $client = null,
40+
EventDispatcherInterface $dispatcher = null,
41+
LoggerInterface $logger = null,
42+
) {
4543
parent::__construct($client, $dispatcher, $logger);
4644
}
4745

0 commit comments

Comments
 (0)