1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* MIT License |
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Episerver\Business\Mapper\Customer; |
9
|
|
|
|
10
|
|
|
use Generated\Shared\Transfer\CustomerTransfer; |
|
|
|
|
11
|
|
|
use Generated\Shared\Transfer\MailTransfer; |
|
|
|
|
12
|
|
|
use Spryker\Shared\Kernel\Store; |
13
|
|
|
use SprykerEco\Zed\Episerver\Dependency\Facade\EpiserverToLocaleFacadeInterface; |
14
|
|
|
use SprykerEco\Zed\Episerver\EpiserverConfig; |
15
|
|
|
|
16
|
|
|
abstract class AbstractCustomerMapper implements CustomerMapperInterface |
17
|
|
|
{ |
18
|
|
|
protected const URL_LOGIN = '/login'; |
19
|
|
|
protected const KEY_EMAIL = 'bmRecipientId'; |
20
|
|
|
protected const KEY_OPT_IN_ID = 'bmOptInId'; |
21
|
|
|
protected const KEY_MAILING_ID = 'bmMailingId'; |
22
|
|
|
protected const KEY_SALUTATION = 'salutation'; |
23
|
|
|
protected const KEY_FIRST_NAME = 'firstname'; |
24
|
|
|
protected const KEY_LAST_NAME = 'lastname'; |
25
|
|
|
protected const KEY_SPRYKER_ID = 'spryker_id'; |
26
|
|
|
protected const KEY_CUSTOMER_SHOP_LOCALE = 'customer_shop_locale'; |
27
|
|
|
protected const KEY_CUSTOMER_SHOP_URL = 'customer_shop_url'; |
28
|
|
|
protected const KEY_CUSTOMER_LOGIN_URL = 'customer_login_url'; |
29
|
|
|
protected const KEY_CUSTOMER_RESET_LINK = 'customer_reset_link'; |
30
|
|
|
protected const KEY_CUSTOMER_SUBSCRIBER_KEY = 'subscriber_key'; |
31
|
|
|
protected const KEY_REMOVE_ID = 'bmRemoveId'; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var \SprykerEco\Zed\Episerver\EpiserverConfig |
35
|
|
|
*/ |
36
|
|
|
protected $config; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var \SprykerEco\Zed\Episerver\Dependency\Facade\EpiserverToLocaleFacadeInterface |
40
|
|
|
*/ |
41
|
|
|
protected $localeFacade; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var \Spryker\Shared\Kernel\Store |
45
|
|
|
*/ |
46
|
|
|
protected $store; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param \SprykerEco\Zed\Episerver\EpiserverConfig $config |
50
|
|
|
* @param \SprykerEco\Zed\Episerver\Dependency\Facade\EpiserverToLocaleFacadeInterface $localeFacade |
51
|
|
|
* @param \Spryker\Shared\Kernel\Store $store |
52
|
|
|
*/ |
53
|
|
|
public function __construct( |
54
|
|
|
EpiserverConfig $config, |
55
|
|
|
EpiserverToLocaleFacadeInterface $localeFacade, |
56
|
|
|
Store $store |
57
|
|
|
) { |
58
|
|
|
$this->config = $config; |
59
|
|
|
$this->localeFacade = $localeFacade; |
60
|
|
|
$this->store = $store; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param \Generated\Shared\Transfer\MailTransfer $mailTransfer |
65
|
|
|
* |
66
|
|
|
* @return array |
67
|
|
|
*/ |
68
|
|
|
abstract protected function buildPayload(MailTransfer $mailTransfer): array; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $mailTypeName |
72
|
|
|
* |
73
|
|
|
* @return string|null |
74
|
|
|
*/ |
75
|
|
|
protected function getMailingIdByMailType(string $mailTypeName): ?string |
76
|
|
|
{ |
77
|
|
|
return $this->config->getMailingIdByMailingTypeName($mailTypeName); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param \Generated\Shared\Transfer\CustomerTransfer|null $customerTransfer |
82
|
|
|
* |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
protected function getLocale(?CustomerTransfer $customerTransfer): string |
86
|
|
|
{ |
87
|
|
|
if ($customerTransfer !== null && |
88
|
|
|
$customerTransfer->getLocale() !== null && |
89
|
|
|
$customerTransfer->getLocale()->getLocaleName() !== null) { |
90
|
|
|
return $this->getLocaleShortName($customerTransfer->getLocale()->getLocaleName()); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
return $this->getLocaleShortName($this->localeFacade->getCurrentLocaleName()); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $localeName |
98
|
|
|
* |
99
|
|
|
* @return string |
100
|
|
|
*/ |
101
|
|
|
protected function getLocaleShortName(string $localeName): string |
102
|
|
|
{ |
103
|
|
|
return (string)array_search($localeName, $this->store->getLocales()); |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths