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 - 2016 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\Model\Entities; |
||||
28 | |||||
29 | use Magento\Framework\Model\AbstractModel; |
||||
0 ignored issues
–
show
|
|||||
30 | use Payone\Core\Helper\Toolkit; |
||||
31 | |||||
32 | /** |
||||
33 | * ApiLog entity model |
||||
34 | */ |
||||
35 | class ApiLog extends AbstractModel |
||||
36 | { |
||||
37 | /** |
||||
38 | * Toolkit helper object |
||||
39 | * |
||||
40 | * @var Toolkit |
||||
41 | */ |
||||
42 | protected $toolkitHelper; |
||||
43 | |||||
44 | /** |
||||
45 | * Constructor |
||||
46 | * |
||||
47 | * @param \Magento\Framework\Model\Context $context |
||||
48 | * @param \Magento\Framework\Registry $registry |
||||
49 | * @param \Payone\Core\Helper\Toolkit $toolkitHelper |
||||
50 | * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource |
||||
51 | * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection |
||||
52 | * @param array $data |
||||
53 | */ |
||||
54 | public function __construct( |
||||
55 | \Magento\Framework\Model\Context $context, |
||||
0 ignored issues
–
show
The type
Magento\Framework\Model\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 ![]() |
|||||
56 | \Magento\Framework\Registry $registry, |
||||
0 ignored issues
–
show
The type
Magento\Framework\Registry 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 ![]() |
|||||
57 | \Payone\Core\Helper\Toolkit $toolkitHelper, |
||||
58 | ?\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, |
||||
0 ignored issues
–
show
The type
Magento\Framework\Model\...eModel\AbstractResource 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 ![]() |
|||||
59 | ?\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, |
||||
0 ignored issues
–
show
The type
Magento\Framework\Data\Collection\AbstractDb 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 ![]() |
|||||
60 | array $data = [] |
||||
61 | ) { |
||||
62 | parent::__construct($context, $registry, $resource, $resourceCollection, $data); |
||||
63 | $this->toolkitHelper = $toolkitHelper; |
||||
64 | } |
||||
65 | |||||
66 | /** |
||||
67 | * Initialize resource model |
||||
68 | * |
||||
69 | * @return void |
||||
70 | */ |
||||
71 | protected function _construct() |
||||
72 | { |
||||
73 | $this->_init('Payone\Core\Model\ResourceModel\ApiLog'); |
||||
74 | } |
||||
75 | |||||
76 | /** |
||||
77 | * Encode the array content for correct displaying |
||||
78 | * |
||||
79 | * @param array $aArray |
||||
80 | * @return array |
||||
81 | */ |
||||
82 | protected function formatArray($aArray) |
||||
83 | { |
||||
84 | foreach ($aArray as $sKey => $mValue) { |
||||
85 | if (!$this->toolkitHelper->isUTF8($mValue)) { |
||||
86 | $aArray[$sKey] = mb_convert_encoding($mValue ?? '', 'UTF-8'); |
||||
87 | } |
||||
88 | } |
||||
89 | return $aArray; |
||||
90 | } |
||||
91 | |||||
92 | /** |
||||
93 | * Unserialize a given column from the entity |
||||
94 | * |
||||
95 | * @param string $sKey |
||||
96 | * @param bool $blSort |
||||
97 | * @return array |
||||
98 | */ |
||||
99 | protected function getUnserializedArray($sKey, $blSort = false) |
||||
100 | { |
||||
101 | $aReturn = []; |
||||
102 | $sRequest = $this->getData($sKey); |
||||
103 | if ($sRequest) { |
||||
104 | try { |
||||
105 | $aRequest = unserialize($sRequest); |
||||
106 | } catch(\Exception $exc) { |
||||
107 | if ($this->toolkitHelper->isUTF8($sRequest)) { |
||||
108 | $aRequest = unserialize(mb_convert_encoding($sRequest ?? '', 'ISO-8859-1', 'UTF-8')); |
||||
0 ignored issues
–
show
It seems like
mb_convert_encoding($sRe... 'ISO-8859-1', 'UTF-8') can also be of type array ; however, parameter $data of unserialize() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
109 | } |
||||
110 | } |
||||
111 | if (is_array($aRequest)) { |
||||
112 | $aReturn = $this->formatArray($aRequest); |
||||
113 | } |
||||
114 | } |
||||
115 | if ($blSort) { |
||||
116 | ksort($aReturn); |
||||
117 | } |
||||
118 | return $aReturn; |
||||
119 | } |
||||
120 | |||||
121 | /** |
||||
122 | * Unserialize raw_request column from entity |
||||
123 | * |
||||
124 | * @return array |
||||
125 | */ |
||||
126 | public function getRawRequestArray() |
||||
127 | { |
||||
128 | return $this->getUnserializedArray('raw_request', true); |
||||
129 | } |
||||
130 | |||||
131 | /** |
||||
132 | * Unserialize raw_response column from entity |
||||
133 | * |
||||
134 | * @return array |
||||
135 | */ |
||||
136 | public function getRawResponseArray() |
||||
137 | { |
||||
138 | return $this->getUnserializedArray('raw_response', true); |
||||
139 | } |
||||
140 | } |
||||
141 |
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