File tree Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,6 @@ public function __construct(
25
25
private int $ groupId ,
26
26
private array $ groupsToDisplay = [],
27
27
) {
28
- $ this ->groupsToDisplay = array_values (array_map ('intval ' , $ groupsToDisplay ));
29
-
30
28
parent ::__construct ('X-Sendgrid-SuppressionGroup ' , json_encode ([
31
29
'group_id ' => $ groupId ,
32
30
'groups_to_display ' => $ this ->groupsToDisplay ,
@@ -38,6 +36,9 @@ public function getGroupId(): int
38
36
return $ this ->groupId ;
39
37
}
40
38
39
+ /**
40
+ * @return int[]
41
+ */
41
42
public function getGroupsToDisplay (): array
42
43
{
43
44
return $ this ->groupsToDisplay ;
Original file line number Diff line number Diff line change @@ -50,29 +50,27 @@ private function addSendgridHeaders(Message $message): void
50
50
return ;
51
51
}
52
52
53
- $ suppressionHeader = null ;
54
-
55
53
foreach ($ headers ->all () as $ header ) {
56
54
if ($ header instanceof SuppressionGroupHeader) {
57
- $ suppressionHeader = $ header ;
58
55
break ;
59
56
}
60
57
}
61
58
62
- if ($ suppressionHeader ) {
63
- $ payload = [
64
- 'asm ' => [
65
- 'group_id ' => $ suppressionHeader ->getGroupId (),
66
- ],
67
- ];
59
+ if (!$ header instanceof SuppressionGroupHeader) {
60
+ return ;
61
+ }
68
62
69
- $ groupsToDisplay = $ suppressionHeader ->getGroupsToDisplay ();
70
- if ($ groupsToDisplay ) {
71
- $ payload ['asm ' ]['groups_to_display ' ] = $ groupsToDisplay ;
72
- }
63
+ $ payload = [
64
+ 'asm ' => [
65
+ 'group_id ' => $ header ->getGroupId (),
66
+ ],
67
+ ];
73
68
74
- $ headers -> addTextHeader ( ' X-SMTPAPI ' , json_encode ( $ payload , \ JSON_UNESCAPED_SLASHES ));
75
- $ headers -> remove ( ' X-Sendgrid-SuppressionGroup ' ) ;
69
+ if ( $ groupsToDisplay = $ header -> getGroupsToDisplay ()) {
70
+ $ payload [ ' asm ' ][ ' groups_to_display ' ] = $ groupsToDisplay ;
76
71
}
72
+
73
+ $ headers ->addTextHeader ('X-SMTPAPI ' , json_encode ($ payload , \JSON_UNESCAPED_SLASHES ));
74
+ $ headers ->remove ('X-Sendgrid-SuppressionGroup ' );
77
75
}
78
76
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ CHANGELOG
6
6
7
7
* Allow query-specific parameters in ` UrlGenerator ` using ` _query `
8
8
* Add support of multiple env names in the ` Symfony\Component\Routing\Attribute\Route ` attribute
9
+ * Add argument ` $parameter ` to ` RequestContext ` 's constructor
9
10
10
11
7.3
11
12
---
You can’t perform that action at this time.
0 commit comments