Passed
Pull Request — master (#3)
by Oleksandr
08:42 queued 04:51
created

EasycreditFactory   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 12
dl 0
loc 61
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getCalculationClient() 0 3 1
A createEasycreditSubForm() 0 3 1
A createEasycreditPaymentHandler() 0 3 1
A createSuccessResponseProcessor() 0 7 1
A createEasycreditDataProvider() 0 3 1
A getQuoteClient() 0 3 1
A getMoneyPlugin() 0 3 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Easycredit;
9
10
use Spryker\Shared\Money\Dependency\Plugin\MoneyPluginInterface;
11
use Spryker\Yves\Kernel\AbstractFactory;
12
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
13
use Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface;
14
use SprykerEco\Yves\Easycredit\Dependency\Client\EasycreditToCalculationClientInterface;
15
use SprykerEco\Yves\Easycredit\Dependency\Client\EasycreditToQuoteClientInterface;
16
use SprykerEco\Yves\Easycredit\Form\DataProvider\EasycreditDataProvider;
17
use SprykerEco\Yves\Easycredit\Form\EasycreditSubForm;
18
use SprykerEco\Yves\Easycredit\Handler\EasycreditPaymentHandler;
19
use SprykerEco\Yves\Easycredit\Handler\EasycreditPaymentHandlerInterface;
20
use SprykerEco\Yves\Easycredit\Processor\SuccessResponseProcessor;
21
use SprykerEco\Yves\Easycredit\Processor\SuccessResponseProcessorInterface;
22
23
/**
24
 * @method \SprykerEco\Client\Easycredit\EasycreditClientInterface getClient()
25
 */
26
class EasycreditFactory extends AbstractFactory
27
{
28
    /**
29
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
30
     */
31
    public function createEasycreditSubForm(): SubFormInterface
32
    {
33
        return new EasycreditSubForm();
34
    }
35
36
    /**
37
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
38
     */
39
    public function createEasycreditDataProvider(): StepEngineFormDataProviderInterface
40
    {
41
        return new EasycreditDataProvider();
42
    }
43
44
    /**
45
     * @return \SprykerEco\Yves\Easycredit\Handler\EasycreditPaymentHandlerInterface
46
     */
47
    public function createEasycreditPaymentHandler(): EasycreditPaymentHandlerInterface
48
    {
49
        return new EasycreditPaymentHandler();
50
    }
51
52
    /**
53
     * @return \SprykerEco\Yves\Easycredit\Processor\SuccessResponseProcessorInterface
54
     */
55
    public function createSuccessResponseProcessor(): SuccessResponseProcessorInterface
56
    {
57
        return new SuccessResponseProcessor(
58
            $this->getQuoteClient(),
59
            $this->getCalculationClient(),
60
            $this->getClient(),
61
            $this->getMoneyPlugin()
62
        );
63
    }
64
65
    /**
66
     * @return \SprykerEco\Yves\Easycredit\Dependency\Client\EasycreditToQuoteClientInterface
67
     */
68
    public function getQuoteClient(): EasycreditToQuoteClientInterface
69
    {
70
        return $this->getProvidedDependency(EasycreditDependencyProvider::CLIENT_QUOTE);
71
    }
72
73
    /**
74
     * @return \SprykerEco\Yves\Easycredit\Dependency\Client\EasycreditToCalculationClientInterface
75
     */
76
    public function getCalculationClient(): EasycreditToCalculationClientInterface
77
    {
78
        return $this->getProvidedDependency(EasycreditDependencyProvider::CLIENT_CALCULATION);
79
    }
80
81
    /**
82
     * @return \Spryker\Shared\Money\Dependency\Plugin\MoneyPluginInterface
83
     */
84
    public function getMoneyPlugin(): MoneyPluginInterface
85
    {
86
        return $this->getProvidedDependency(EasycreditDependencyProvider::PLUGIN_MONEY);
87
    }
88
}
89