PAYONE-GmbH /
magento-2
| 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 | * TransactionStatus entity model |
||||
| 34 | */ |
||||
| 35 | class TransactionStatus 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 Loading history...
|
|||||
| 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 Loading history...
|
|||||
| 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 Loading history...
|
|||||
| 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 Loading history...
|
|||||
| 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\TransactionStatus'); |
||||
| 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 (is_array($mValue)) { |
||||
| 86 | $aArray[$sKey] = $this->formatArray($mValue); |
||||
| 87 | } elseif (!$this->toolkitHelper->isUTF8($mValue)) { |
||||
| 88 | $aArray[$sKey] = mb_convert_encoding($mValue, 'UTF-8'); |
||||
| 89 | } |
||||
| 90 | } |
||||
| 91 | return $aArray; |
||||
| 92 | } |
||||
| 93 | |||||
| 94 | /** |
||||
| 95 | * Unserialize a given column from the entity |
||||
| 96 | * |
||||
| 97 | * @param string $sKey |
||||
| 98 | * @param bool $blSort |
||||
| 99 | * @return array |
||||
| 100 | */ |
||||
| 101 | protected function getUnserializedArray($sKey, $blSort = false) |
||||
| 102 | { |
||||
| 103 | $aReturn = []; |
||||
| 104 | $sRequest = $this->getData($sKey); |
||||
| 105 | if ($sRequest) { |
||||
| 106 | try { |
||||
| 107 | $aRequest = unserialize($sRequest); |
||||
| 108 | } catch(\Exception $exc) { |
||||
| 109 | if ($this->toolkitHelper->isUTF8($sRequest)) { |
||||
| 110 | $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
Loading history...
|
|||||
| 111 | } |
||||
| 112 | } |
||||
| 113 | if (is_array($aRequest)) { |
||||
| 114 | $aReturn = $this->formatArray($aRequest); |
||||
| 115 | } |
||||
| 116 | } |
||||
| 117 | if ($blSort) { |
||||
| 118 | ksort($aReturn); |
||||
| 119 | } |
||||
| 120 | return $aReturn; |
||||
| 121 | } |
||||
| 122 | |||||
| 123 | /** |
||||
| 124 | * Unserialize raw_status column from entity |
||||
| 125 | * |
||||
| 126 | * @return array |
||||
| 127 | */ |
||||
| 128 | public function getRawStatusArray() |
||||
| 129 | { |
||||
| 130 | return $this->getUnserializedArray('raw_status', true); |
||||
| 131 | } |
||||
| 132 | } |
||||
| 133 |
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