Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SenderResolver.php
Go to the documentation of this file.
1 <?php
7 
9 {
15  protected $_scopeConfig;
16 
21  {
22  $this->_scopeConfig = $scopeConfig;
23  }
24 
28  public function resolve($sender, $scopeId = null)
29  {
30  $result = [];
31 
32  if (!is_array($sender)) {
33  $result['name'] = $this->_scopeConfig->getValue(
34  'trans_email/ident_' . $sender . '/name',
36  $scopeId
37  );
38  $result['email'] = $this->_scopeConfig->getValue(
39  'trans_email/ident_' . $sender . '/email',
41  $scopeId
42  );
43  } else {
44  $result = $sender;
45  }
46 
47  if (!isset($result['name']) || !isset($result['email'])) {
48  throw new \Magento\Framework\Exception\MailException(__('Invalid sender data'));
49  }
50 
51  return $result;
52  }
53 }
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
__()
Definition: __.php:13