1 | <?php |
||
2 | |||
3 | /** |
||
4 | * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
||
5 | * it under the terms of the GNU Lesser General Public License as published by |
||
6 | * the Free Software Foundation, either version 3 of the License, or |
||
7 | * (at your option) any later version. |
||
8 | * |
||
9 | * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | * GNU Lesser General Public License for more details. |
||
13 | * |
||
14 | * You should have received a copy of the GNU Lesser General Public License |
||
15 | * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
||
16 | * |
||
17 | * PHP version 5 |
||
18 | * |
||
19 | * @category Payone |
||
20 | * @package Payone_Magento2_Plugin |
||
21 | * @author FATCHIP GmbH <[email protected]> |
||
22 | * @copyright 2003 - 2018 Payone GmbH |
||
23 | * @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
||
24 | * @link http://www.payone.de |
||
25 | */ |
||
26 | |||
27 | namespace Payone\Core\Helper; |
||
28 | |||
29 | /** |
||
30 | * Helper class for sending emails |
||
31 | */ |
||
32 | class Mail extends \Payone\Core\Helper\Base |
||
33 | { |
||
34 | /** |
||
35 | * Email transport builder object |
||
36 | * |
||
37 | * @var \Magento\Framework\Mail\Template\TransportBuilder |
||
0 ignored issues
–
show
|
|||
38 | */ |
||
39 | protected $transportBuilder; |
||
40 | |||
41 | /** |
||
42 | * Constructor |
||
43 | * |
||
44 | * @param \Magento\Framework\App\Helper\Context $context |
||
45 | * @param \Magento\Store\Model\StoreManagerInterface $storeManager |
||
46 | * @param \Payone\Core\Helper\Shop $shopHelper |
||
47 | * @param \Magento\Framework\App\State $state |
||
48 | * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder |
||
49 | */ |
||
50 | public function __construct( |
||
51 | \Magento\Framework\App\Helper\Context $context, |
||
0 ignored issues
–
show
The type
Magento\Framework\App\Helper\Context was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
52 | \Magento\Store\Model\StoreManagerInterface $storeManager, |
||
0 ignored issues
–
show
The type
Magento\Store\Model\StoreManagerInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
53 | \Payone\Core\Helper\Shop $shopHelper, |
||
54 | \Magento\Framework\App\State $state, |
||
0 ignored issues
–
show
The type
Magento\Framework\App\State was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
55 | \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder |
||
56 | ) { |
||
57 | parent::__construct($context, $storeManager, $shopHelper, $state); |
||
58 | $this->transportBuilder = $transportBuilder; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Generate array with sender data |
||
63 | * |
||
64 | * @return array |
||
65 | */ |
||
66 | protected function getShopSenderArray() |
||
67 | { |
||
68 | return [ |
||
69 | 'name' => $this->getConfigParam('name', 'ident_general', 'trans_email'), |
||
70 | 'email' => $this->getConfigParam('email', 'ident_general', 'trans_email'), |
||
71 | ]; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Send email to given recipient |
||
76 | * |
||
77 | * @param string $sRecipient |
||
78 | * @param string $sTemplateIdentifier |
||
79 | * @param array $aData |
||
80 | * @param bool $sArea |
||
81 | * @return void |
||
82 | */ |
||
83 | public function sendEmail($sRecipient, $sTemplateIdentifier, $aData = [], $sArea = false) |
||
84 | { |
||
85 | if ($sArea === false) { |
||
86 | $sArea = \Magento\Framework\App\Area::AREA_FRONTEND; |
||
0 ignored issues
–
show
The type
Magento\Framework\App\Area was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
87 | } |
||
88 | |||
89 | $aOptions = [ |
||
90 | 'area' => $sArea, |
||
91 | 'store' => $this->shopHelper->getStoreId(), |
||
92 | ]; |
||
93 | |||
94 | $oTransport = $this->transportBuilder |
||
95 | ->setTemplateIdentifier($sTemplateIdentifier) |
||
96 | ->setTemplateOptions($aOptions) |
||
97 | ->setTemplateVars($aData) |
||
98 | ->setFrom($this->getShopSenderArray()) |
||
99 | ->addTo($sRecipient) |
||
100 | ->getTransport(); |
||
101 | |||
102 | $oTransport->sendMessage(); |
||
103 | } |
||
104 | } |
||
105 |
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