@@ -2038,27 +2038,23 @@ protected function _validate()
2038
2038
*/
2039
2039
protected function _getNewCustomerEmail ()
2040
2040
{
2041
- $ emailrequired = $ this ->getIsEmailRequired ();
2042
-
2043
- if ($ emailrequired ) {
2044
- return $ this ->getData ('account/email ' );
2045
- } else {
2046
- $ email = $ this ->getData ('account/email ' );
2047
- if (empty ($ email )) {
2048
- $ email = $ this -> generateEmail ();
2049
- }
2050
- return $ email ;
2041
+ $ email = $ this ->getData ('account/email ' );
2042
+
2043
+ if ($ email || $ this ->getIsEmailRequired ()) {
2044
+ return $ email ;
2051
2045
}
2046
+
2047
+ return $ this ->generateEmail ();
2052
2048
}
2053
2049
2054
2050
/**
2055
2051
* Check email is require
2056
2052
*
2057
2053
* @return bool
2058
2054
*/
2059
- protected function getIsEmailRequired ()
2055
+ private function getIsEmailRequired (): bool
2060
2056
{
2061
- return $ this ->_scopeConfig ->getValue (
2057
+ return ( bool ) $ this ->_scopeConfig ->getValue (
2062
2058
self ::XML_PATH_EMAIL_REQUIRED_CREATE_ORDER ,
2063
2059
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
2064
2060
);
@@ -2069,7 +2065,7 @@ protected function getIsEmailRequired()
2069
2065
*
2070
2066
* @return string
2071
2067
*/
2072
- protected function generateEmail ()
2068
+ private function generateEmail (): string
2073
2069
{
2074
2070
$ host = $ this ->_scopeConfig ->getValue (
2075
2071
self ::XML_PATH_DEFAULT_EMAIL_DOMAIN ,
@@ -2080,6 +2076,7 @@ protected function generateEmail()
2080
2076
$ account = $ this ->getData ('account ' );
2081
2077
$ account ['email ' ] = $ email ;
2082
2078
$ this ->setData ('account ' , $ account );
2079
+
2083
2080
return $ email ;
2084
2081
}
2085
2082
0 commit comments