wirecardBrasil /
magento2
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Copyright © Wirecard Brasil. All rights reserved. |
||||
| 4 | * |
||||
| 5 | * @author Bruno Elisei <[email protected]> |
||||
| 6 | * See COPYING.txt for license details. |
||||
| 7 | */ |
||||
| 8 | |||||
| 9 | namespace Moip\Magento2\Model\Ui\Vault; |
||||
| 10 | |||||
| 11 | use Magento\Checkout\Model\ConfigProviderInterface; |
||||
|
0 ignored issues
–
show
|
|||||
| 12 | use Magento\Framework\Exception\InputException; |
||||
|
0 ignored issues
–
show
The type
Magento\Framework\Exception\InputException 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...
|
|||||
| 13 | use Magento\Framework\Exception\NoSuchEntityException; |
||||
|
0 ignored issues
–
show
The type
Magento\Framework\Exception\NoSuchEntityException 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...
|
|||||
| 14 | use Magento\Framework\View\Asset\Source; |
||||
|
0 ignored issues
–
show
The type
Magento\Framework\View\Asset\Source 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...
|
|||||
| 15 | use Magento\Payment\Model\CcConfig; |
||||
|
0 ignored issues
–
show
The type
Magento\Payment\Model\CcConfig 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...
|
|||||
| 16 | use Magento\Quote\Api\Data\CartInterface; |
||||
|
0 ignored issues
–
show
The type
Magento\Quote\Api\Data\CartInterface 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...
|
|||||
| 17 | use Moip\Magento2\Gateway\Config\ConfigCc; |
||||
| 18 | use Moip\Magento2\Gateway\Config\ConfigCcVault; |
||||
| 19 | |||||
| 20 | class ConfigProvider implements ConfigProviderInterface |
||||
| 21 | { |
||||
| 22 | const CODE = 'moip_magento2_cc_vault'; |
||||
| 23 | /** |
||||
| 24 | * @var Config |
||||
| 25 | */ |
||||
| 26 | private $configCcVault; |
||||
| 27 | |||||
| 28 | /** |
||||
| 29 | * @var CartInterface |
||||
| 30 | */ |
||||
| 31 | private $cart; |
||||
| 32 | |||||
| 33 | /** |
||||
| 34 | * @var array |
||||
| 35 | */ |
||||
| 36 | private $icons = []; |
||||
| 37 | |||||
| 38 | /** |
||||
| 39 | * @var CcConfig |
||||
| 40 | */ |
||||
| 41 | protected $ccConfig; |
||||
| 42 | |||||
| 43 | /** |
||||
| 44 | * @var CcConfig |
||||
| 45 | */ |
||||
| 46 | protected $configCc; |
||||
| 47 | |||||
| 48 | /** |
||||
| 49 | * @var \Magento\Framework\View\Asset\Source |
||||
| 50 | */ |
||||
| 51 | protected $assetSource; |
||||
| 52 | |||||
| 53 | /** |
||||
| 54 | * ConfigProvider constructor. |
||||
| 55 | * |
||||
| 56 | * @param Config $config |
||||
| 57 | */ |
||||
| 58 | public function __construct( |
||||
| 59 | CartInterface $cart, |
||||
| 60 | ConfigCc $configCc, |
||||
| 61 | ConfigCcVault $configCcVault, |
||||
| 62 | CcConfig $ccConfig, |
||||
| 63 | Source $assetSource |
||||
| 64 | ) { |
||||
| 65 | $this->cart = $cart; |
||||
| 66 | $this->configCc = $configCc; |
||||
| 67 | $this->assetSource = $assetSource; |
||||
| 68 | $this->ccConfig = $ccConfig; |
||||
| 69 | $this->configCcVault = $configCcVault; |
||||
| 70 | } |
||||
| 71 | |||||
| 72 | /** |
||||
| 73 | * Retrieve assoc array of checkout configuration. |
||||
| 74 | * |
||||
| 75 | * @throws InputException |
||||
| 76 | * @throws NoSuchEntityException |
||||
| 77 | * |
||||
| 78 | * @return array |
||||
| 79 | */ |
||||
| 80 | public function getConfig() |
||||
| 81 | { |
||||
| 82 | $storeId = $this->cart->getStoreId(); |
||||
| 83 | |||||
| 84 | return [ |
||||
| 85 | 'payment' => [ |
||||
| 86 | self::CODE => [ |
||||
| 87 | 'useCvv' => $this->configCcVault->useCvv($storeId), |
||||
| 88 | 'icons' => $this->getIcons(), |
||||
| 89 | ], |
||||
| 90 | ], |
||||
| 91 | ]; |
||||
| 92 | } |
||||
| 93 | |||||
| 94 | /** |
||||
| 95 | * Get icons for available payment methods. |
||||
| 96 | * |
||||
| 97 | * @return array |
||||
| 98 | */ |
||||
| 99 | public function getIcons() |
||||
| 100 | { |
||||
| 101 | if (!empty($this->icons)) { |
||||
| 102 | return $this->icons; |
||||
| 103 | } |
||||
| 104 | $storeId = $this->cart->getStoreId(); |
||||
| 105 | $ccTypes = $this->configCc->getCcAvailableTypes($storeId); |
||||
| 106 | $types = explode(',', $ccTypes); |
||||
| 107 | foreach ($types as $code => $label) { |
||||
| 108 | if (!array_key_exists($code, $this->icons)) { |
||||
| 109 | $asset = $this->ccConfig->createAsset('Moip_Magento2::images/cc/'.strtolower($label).'.svg'); |
||||
| 110 | $placeholder = $this->assetSource->findSource($asset); |
||||
| 111 | if ($placeholder) { |
||||
| 112 | list($width, $height) = getimagesizefromstring($asset->getSourceFile()); |
||||
| 113 | $this->icons[$label] = [ |
||||
| 114 | 'url' => $asset->getUrl(), |
||||
| 115 | 'width' => $width, |
||||
| 116 | 'height' => $height, |
||||
| 117 | 'title' => __($label), |
||||
|
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 118 | ]; |
||||
| 119 | } |
||||
| 120 | } |
||||
| 121 | } |
||||
| 122 | |||||
| 123 | return $this->icons; |
||||
| 124 | } |
||||
| 125 | } |
||||
| 126 |
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