@@ -343,8 +343,8 @@ public function getProcessedTemplate(array $variables = [])
343
343
}
344
344
$ processor ->setStoreId ($ storeId );
345
345
346
- // Populate the variables array with store, store info, logo, etc. variables
347
- $ variables = $ this ->addEmailVariables ( $ variables , $ storeId );
346
+ // Populate the variables array with store, store info, logo, etc.
347
+ $ variables + = $ this ->getEmailVariables ( $ storeId );
348
348
$ processor ->setVariables ($ variables );
349
349
350
350
try {
@@ -420,62 +420,45 @@ protected function getLogoAlt($store)
420
420
}
421
421
422
422
/**
423
- * Add variables that are used by transactional and newsletter emails
423
+ * Returns variables that are used by transactional and newsletter emails
424
424
*
425
- * @param array $variables
426
425
* @param null|string|bool|int|\Magento\Store\Model\Store $storeId
427
426
* @return mixed
428
- *
429
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
430
- * @SuppressWarnings(PHPMD.NPathComplexity)
431
427
*/
432
- protected function addEmailVariables ( $ variables , $ storeId )
428
+ protected function getEmailVariables ( $ storeId )
433
429
{
434
430
$ store = $ this ->storeManager ->getStore ($ storeId );
435
- if (!isset ($ variables ['store ' ])) {
436
- $ variables ['store ' ] = $ store ;
437
- }
438
- if (!isset ($ variables ['logo_url ' ])) {
439
- $ variables ['logo_url ' ] = $ this ->getLogoUrl ($ storeId );
440
- }
441
- if (!isset ($ variables ['logo_alt ' ])) {
442
- $ variables ['logo_alt ' ] = $ this ->getLogoAlt ($ storeId );
443
- }
444
- if (!isset ($ variables ['logo_width ' ])) {
445
- $ variables ['logo_width ' ] = $ this ->scopeConfig ->getValue (
431
+
432
+ $ variables = [
433
+ 'store ' => $ store ,
434
+ 'logo_url ' => $ this ->getLogoUrl ($ storeId ),
435
+ 'logo_alt ' => $ this ->getLogoAlt ($ storeId ),
436
+ 'logo_width ' => $ this ->scopeConfig ->getValue (
446
437
self ::XML_PATH_DESIGN_EMAIL_LOGO_WIDTH ,
447
438
ScopeInterface::SCOPE_STORE ,
448
439
$ store
449
- );
450
- }
451
- if (!isset ($ variables ['logo_height ' ])) {
452
- $ variables ['logo_height ' ] = $ this ->scopeConfig ->getValue (
440
+ ),
441
+ 'logo_height ' => $ this ->scopeConfig ->getValue (
453
442
self ::XML_PATH_DESIGN_EMAIL_LOGO_HEIGHT ,
454
443
ScopeInterface::SCOPE_STORE ,
455
444
$ store
456
- );
457
- }
458
- if (!isset ($ variables ['store_phone ' ])) {
459
- $ variables ['store_phone ' ] = $ this ->scopeConfig ->getValue (
445
+ ),
446
+ 'store_phone ' => $ this ->scopeConfig ->getValue (
460
447
\Magento \Store \Model \Store::XML_PATH_STORE_STORE_PHONE ,
461
448
ScopeInterface::SCOPE_STORE ,
462
449
$ store
463
- );
464
- }
465
- if (!isset ($ variables ['store_hours ' ])) {
466
- $ variables ['store_hours ' ] = $ this ->scopeConfig ->getValue (
450
+ ),
451
+ 'store_hours ' => $ this ->scopeConfig ->getValue (
467
452
\Magento \Store \Model \Store::XML_PATH_STORE_STORE_HOURS ,
468
453
ScopeInterface::SCOPE_STORE ,
469
454
$ store
470
- );
471
- }
472
- if (!isset ($ variables ['store_email ' ])) {
473
- $ variables ['store_email ' ] = $ this ->scopeConfig ->getValue (
455
+ ),
456
+ 'store_email ' => $ this ->scopeConfig ->getValue (
474
457
'trans_email/ident_support/email ' ,
475
458
ScopeInterface::SCOPE_STORE ,
476
459
$ store
477
- );
478
- }
460
+ ),
461
+ ];
479
462
// If template is text mode, don't include styles
480
463
if (!$ this ->isPlain () && !isset ($ variables ['template_styles ' ])) {
481
464
$ variables ['template_styles ' ] = $ this ->getTemplateStyles ();
0 commit comments