Passed
Pull Request — master (#84)
by Olha
12:53
created

ParametersReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
c 1
b 0
f 0
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getRequestStandardParameter() 0 13 1
A __construct() 0 4 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Payone\Communication\Model;
9
10
use Generated\Shared\Transfer\PayoneStandardParameterTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...andardParameterTransfer 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface;
12
use SprykerEco\Zed\Payone\PayoneConfig;
13
14
class ParametersReader implements ParametersReaderInterface
15
{
16
    /**
17
     * @var \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface
18
     */
19
    protected PayoneToStoreFacadeInterface $storeFacade;
20
21
    /**
22
     * @var \SprykerEco\Zed\Payone\PayoneConfig
23
     */
24
    protected PayoneConfig $payoneConfig;
25
26
    /**
27
     * @param \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeInterface $storeFacade
28
     * @param \SprykerEco\Zed\Payone\PayoneConfig $payoneConfig
29
     */
30
    public function __construct(PayoneToStoreFacadeInterface $storeFacade, PayoneConfig $payoneConfig)
31
    {
32
        $this->storeFacade = $storeFacade;
33
        $this->payoneConfig = $payoneConfig;
34
    }
35
36
    /**
37
     * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
38
     */
39
    public function getRequestStandardParameter(): PayoneStandardParameterTransfer
40
    {
41
        $storeTransfer = $this->storeFacade->getCurrentStore();
42
43
        $standardParameter = $this->payoneConfig->getRequestStandardParameter();
44
        $standardParameter->setCurrency(
45
            current($storeTransfer->getAvailableCurrencyIsoCodes()),
46
        );
47
        $standardParameter->setLanguage(
48
            current($storeTransfer->getCountries()),
49
        );
50
51
        return $standardParameter;
52
    }
53
}
54