| 1 | <?php |
||
| 2 | |||
| 3 | namespace Getloy\GetloyMagentoGateway\Gateway\Validator; |
||
| 4 | |||
| 5 | use Magento\Payment\Gateway\ConfigInterface; |
||
| 6 | use Magento\Payment\Gateway\Validator\AbstractValidator; |
||
| 7 | use Magento\Payment\Gateway\Validator\ResultInterface; |
||
| 8 | use Magento\Payment\Gateway\Validator\ResultInterfaceFactory; |
||
|
0 ignored issues
–
show
|
|||
| 9 | |||
| 10 | class CurrencyValidator extends AbstractValidator |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var \Magento\Payment\Gateway\ConfigInterface |
||
| 14 | */ |
||
| 15 | private $config; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param ResultInterfaceFactory $resultFactory |
||
| 19 | * @param ConfigInterface $config |
||
| 20 | */ |
||
| 21 | public function __construct( |
||
| 22 | ResultInterfaceFactory $resultFactory, |
||
| 23 | ConfigInterface $config |
||
| 24 | ) { |
||
| 25 | $this->config = $config; |
||
| 26 | parent::__construct($resultFactory); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Performs domain-related validation for business object |
||
| 31 | * |
||
| 32 | * @param array $validationSubject |
||
| 33 | * @return ResultInterface |
||
| 34 | */ |
||
| 35 | public function validate(array $validationSubject) |
||
| 36 | { |
||
| 37 | $isValid = true; |
||
| 38 | $storeId = $validationSubject[ 'storeId' ]; |
||
| 39 | $currency = $validationSubject[ 'currency' ]; |
||
| 40 | |||
| 41 | if ($currency !== $this->config->getValue('currency', $storeId)) { |
||
| 42 | $isValid = false; |
||
| 43 | } |
||
| 44 | if (!\in_array($currency, [ 'USD' ])) { |
||
| 45 | $isValid = false; |
||
| 46 | } |
||
| 47 | |||
| 48 | return $this->createResult($isValid); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
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