Passed
Pull Request — master (#84)
by Yaroslav
05:25
created

PayoneCommunicationFactory::getSalesFacade()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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;
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 Spryker\Zed\Kernel\Communication\AbstractCommunicationFactory;
12
use SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface;
13
use SprykerEco\Zed\Payone\Business\Key\UrlHmacGenerator;
14
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToCalculationInterface;
15
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToOmsInterface;
16
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToRefundInterface;
17
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToSalesInterface;
18
use SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeBridge;
19
use SprykerEco\Zed\Payone\PayoneDependencyProvider;
20
21
/**
22
 * @method \SprykerEco\Zed\Payone\PayoneConfig getConfig()
23
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneQueryContainerInterface getQueryContainer()
24
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneRepositoryInterface getRepository()
25
 * @method \SprykerEco\Zed\Payone\Persistence\PayoneEntityManagerInterface getEntityManager()
26
 * @method \SprykerEco\Zed\Payone\Business\PayoneFacadeInterface getFacade()
27
 */
28
class PayoneCommunicationFactory extends AbstractCommunicationFactory
29
{
30
    /**
31
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToOmsInterface
32
     */
33
    public function getOmsFacade(): PayoneToOmsInterface
34
    {
35
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_OMS);
36
    }
37
38
    /**
39
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToSalesInterface
40
     */
41
    public function getSalesFacade(): PayoneToSalesInterface
42
    {
43
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_SALES);
44
    }
45
46
    /**
47
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToRefundInterface
48
     */
49
    public function getRefundFacade(): PayoneToRefundInterface
50
    {
51
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_REFUND);
52
    }
53
54
    /**
55
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToCalculationInterface
56
     */
57
    public function getCalculationFacade(): PayoneToCalculationInterface
58
    {
59
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_CALCULATION);
60
    }
61
62
    /**
63
     * @return \SprykerEco\Zed\Payone\Dependency\Facade\PayoneToStoreFacadeBridge
64
     */
65
    public function getStoreFacade(): PayoneToStoreFacadeBridge
66
    {
67
        return $this->getProvidedDependency(PayoneDependencyProvider::FACADE_STORE);
68
    }
69
70
    /**
71
     * @return \SprykerEco\Zed\Payone\Business\Key\HmacGeneratorInterface
72
     */
73
    public function createUrlHmacGenerator(): HmacGeneratorInterface
74
    {
75
        return new UrlHmacGenerator();
76
    }
77
78
    /**
79
     * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer
80
     */
81
    public function getStandardParameter(): PayoneStandardParameterTransfer
82
    {
83
        $storeTransfer = $this->getStoreFacade()->getCurrentStore();
84
85
        return $this->getConfig()->getRequestStandardParameter(
86
            current($storeTransfer->getAvailableCurrencyIsoCodes()),
0 ignored issues
show
Unused Code introduced by
The call to SprykerEco\Zed\Payone\Pa...uestStandardParameter() has too many arguments starting with current($storeTransfer->...ableCurrencyIsoCodes()). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

86
        return $this->getConfig()->/** @scrutinizer ignore-call */ getRequestStandardParameter(

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
87
            current($storeTransfer->getCountries())
88
        );
89
    }
90
}
91