18
18
19
19
abstract class AbstractMailSender
20
20
{
21
- protected TransportBuilder $ transportBuilder ;
22
-
23
- private ScopeConfigInterface $ scopeConfig ;
21
+ private const CONFIG_PATH_ENABLED = 'gdpr/notification/enabled ' ;
24
22
25
23
/**
26
- * @var string[]
27
- */
28
- private array $ configPaths ;
29
-
30
- /**
31
- * @param TransportBuilder $transportBuilder
32
- * @param ScopeConfigInterface $scopeConfig
33
24
* @param string[] $configPaths
34
25
*/
35
26
public function __construct (
36
- TransportBuilder $ transportBuilder ,
37
- ScopeConfigInterface $ scopeConfig ,
38
- array $ configPaths
39
- ) {
40
- $ this ->transportBuilder = $ transportBuilder ;
41
- $ this ->scopeConfig = $ scopeConfig ;
42
- $ this ->configPaths = $ configPaths ;
43
- }
27
+ protected TransportBuilder $ transportBuilder ,
28
+ private ScopeConfigInterface $ scopeConfig ,
29
+ private array $ configPaths = []
30
+ ) {}
44
31
45
32
/**
46
- * @param string $sendTo
47
- * @param string|null $name [optional] Specify the to name.
48
- * @param int|null $storeId [optional Current store ID is used by default.
49
- * @param array $vars
50
33
* @throws LocalizedException
51
34
* @throws MailException
52
35
*/
@@ -77,10 +60,6 @@ protected function sendMail(string $sendTo, ?string $name = null, ?int $storeId
77
60
}
78
61
79
62
/**
80
- * @param string $sendTo
81
- * @param string|null $name [optional] Specify the to name.
82
- * @param int|null $storeId [optional Current store ID is used by default.
83
- * @param array $vars
84
63
* @throws MailException
85
64
*/
86
65
protected function prepareMail (string $ sendTo , ?string $ name = null , ?int $ storeId = null , array $ vars = []): void
@@ -92,23 +71,12 @@ protected function prepareMail(string $sendTo, ?string $name = null, ?int $store
92
71
->addTo ($ sendTo , $ name );
93
72
}
94
73
95
- /**
96
- * @param int|null $storeId [optional] Retrieves the value by scope.
97
- * @return bool
98
- */
99
74
protected function isAvailable (?int $ storeId = null ): bool
100
75
{
101
- return $ this ->scopeConfig ->isSetFlag (
102
- $ this ->configPaths ['is_available ' ],
103
- ScopeInterface::SCOPE_STORE ,
104
- $ storeId
105
- );
76
+ return $ this ->scopeConfig ->isSetFlag (self ::CONFIG_PATH_ENABLED , ScopeInterface::SCOPE_STORE , $ storeId )
77
+ && $ this ->scopeConfig ->isSetFlag ($ this ->configPaths ['is_available ' ], ScopeInterface::SCOPE_STORE , $ storeId );
106
78
}
107
79
108
- /**
109
- * @param int|null $storeId [optional] Retrieves the value by scope.
110
- * @return string
111
- */
112
80
protected function getFrom (?int $ storeId = null ): string
113
81
{
114
82
return (string )$ this ->scopeConfig ->getValue (
@@ -118,10 +86,6 @@ protected function getFrom(?int $storeId = null): string
118
86
);
119
87
}
120
88
121
- /**
122
- * @param int|null $storeId [optional] Retrieves the value by scope.
123
- * @return array
124
- */
125
89
protected function getCopyTo (?int $ storeId = null ): array
126
90
{
127
91
return explode (
@@ -134,10 +98,6 @@ protected function getCopyTo(?int $storeId = null): array
134
98
);
135
99
}
136
100
137
- /**
138
- * @param int|null $storeId [optional] Retrieves the value by scope.
139
- * @return string
140
- */
141
101
protected function getCopyMethod (?int $ storeId = null ): string
142
102
{
143
103
return (string )$ this ->scopeConfig ->getValue (
@@ -147,10 +107,6 @@ protected function getCopyMethod(?int $storeId = null): string
147
107
);
148
108
}
149
109
150
- /**
151
- * @param int|null $storeId [optional] Retrieves the value by scope.
152
- * @return string
153
- */
154
110
protected function getTemplateIdentifier (?int $ storeId = null ): string
155
111
{
156
112
return (string )$ this ->scopeConfig ->getValue (
0 commit comments