Passed
Push — feature/paypal-express ( ec9040...c08f5f )
by Volodymyr
06:46
created

BraintreeFactory::getStore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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\Braintree;
9
10
use Spryker\Yves\Kernel\AbstractFactory;
11
use Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface;
12
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToGlossaryClientInterface;
13
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToPaymentClientInterface;
14
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToQuoteClientInterface;
15
use SprykerEco\Yves\Braintree\Dependency\Client\BraintreeToShipmentClientInterface;
16
use SprykerEco\Yves\Braintree\Dependency\Service\BraintreeToUtilEncodingServiceInterface;
17
use SprykerEco\Yves\Braintree\Form\CreditCardSubForm;
18
use SprykerEco\Yves\Braintree\Form\DataProvider\BraintreePaypalExpressShipmentFormDataProvider;
0 ignored issues
show
Bug introduced by
The type SprykerEco\Yves\Braintre...hipmentFormDataProvider 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...
19
use SprykerEco\Yves\Braintree\Form\DataProvider\BraintreePaypalExpressShipmentFormDataProviderInterface;
0 ignored issues
show
Bug introduced by
The type SprykerEco\Yves\Braintre...rmDataProviderInterface 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...
20
use SprykerEco\Yves\Braintree\Form\DataProvider\CheckoutShipmentFormDataProvider;
21
use SprykerEco\Yves\Braintree\Form\DataProvider\CreditCardDataProvider;
22
use SprykerEco\Yves\Braintree\Form\DataProvider\PayPalDataProvider;
23
use SprykerEco\Yves\Braintree\Form\DataProvider\SummaryFormDataProvider;
0 ignored issues
show
Bug introduced by
The type SprykerEco\Yves\Braintre...SummaryFormDataProvider 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...
24
use SprykerEco\Yves\Braintree\Form\PayPalExpressSubForm;
25
use SprykerEco\Yves\Braintree\Form\PayPalSubForm;
26
use SprykerEco\Yves\Braintree\Handler\BraintreeHandler;
27
use SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse\PaypalResponseMapper;
28
use SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse\PaypalResponseMapperInterface;
29
use SprykerEco\Yves\Braintree\Model\Processor\PaypalResponseProcessor;
30
use SprykerEco\Yves\Braintree\Model\Processor\PaypalResponseProcessorInterface;
31
32
/**
33
 * @method \SprykerEco\Yves\Braintree\BraintreeConfig getConfig()
34
 */
35
class BraintreeFactory extends AbstractFactory
36
{
37
    /**
38
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
39
     */
40
    public function createPayPalForm()
41
    {
42
        return new PayPalSubForm();
43
    }
44
45
    /**
46
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
47
     */
48
    public function createPayPalExpressForm()
49
    {
50
        return new PayPalExpressSubForm();
51
    }
52
53
    /**
54
     * @return \Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface
55
     */
56
    public function createCreditCardForm()
57
    {
58
        return new CreditCardSubForm();
59
    }
60
61
    /**
62
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
63
     */
64
    public function createPayPalFormDataProvider()
65
    {
66
        return new PayPalDataProvider();
67
    }
68
69
    /**
70
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
71
     */
72
    public function createPayPalExpressFormDataProvider()
73
    {
74
        return new PayPalDataProvider();
75
    }
76
77
    /**
78
     * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface
79
     */
80
    public function createCreditCardFormDataProvider()
81
    {
82
        return new CreditCardDataProvider();
83
    }
84
85
    /**
86
     * @return \SprykerEco\Yves\Braintree\Handler\BraintreeHandlerInterface
87
     */
88
    public function createBraintreeHandler()
89
    {
90
        return new BraintreeHandler($this->getCurrencyPlugin());
91
    }
92
93
    /**
94
     * @return \Spryker\Yves\Currency\Plugin\CurrencyPluginInterface
95
     */
96
    public function getCurrencyPlugin()
97
    {
98
        return $this->getProvidedDependency(BraintreeDependencyProvider::PLUGIN_CURRENCY);
99
    }
100
101
    /**
102
     * @return \SprykerEco\Yves\Braintree\Model\Processor\PaypalResponseProcessorInterface
103
     */
104
    public function createResponseProcessor(): PaypalResponseProcessorInterface
105
    {
106
        return new PaypalResponseProcessor(
107
            $this->createPaypalResponseMapper(),
108
            $this->getQuoteClient()
109
        );
110
    }
111
112
    /**
113
     * @return \SprykerEco\Yves\Braintree\Model\Mapper\PaypalResponse\PaypalResponseMapperInterface
114
     */
115
    public function createPaypalResponseMapper(): PaypalResponseMapperInterface
116
    {
117
        return new PaypalResponseMapper($this->getPaymentClient());
118
    }
119
120
    /**
121
     * @return BraintreeToUtilEncodingServiceInterface
122
     */
123
    public function getUtilEncodingService(): BraintreeToUtilEncodingServiceInterface
124
    {
125
        return $this->getProvidedDependency(BraintreeDependencyProvider::SERVICE_UTIL_ENCODING);
126
    }
127
128
    /**
129
     * @return BraintreeToQuoteClientInterface
130
     */
131
    public function getQuoteClient(): BraintreeToQuoteClientInterface
132
    {
133
        return $this->getProvidedDependency(BraintreeDependencyProvider::CLIENT_QUOTE);
134
    }
135
136
    /**
137
     * @return BraintreeToShipmentClientInterface
138
     */
139
    public function getShipmentClient(): BraintreeToShipmentClientInterface
140
    {
141
        return $this->getProvidedDependency(BraintreeDependencyProvider::CLIENT_SHIPMENT);
142
    }
143
144
    /**
145
     * @return BraintreeToGlossaryClientInterface
146
     */
147
    public function getGlossaryClient(): BraintreeToGlossaryClientInterface
148
    {
149
        return $this->getProvidedDependency(BraintreeDependencyProvider::CLIENT_GLOSSARY);
150
    }
151
152
    /**
153
     * @return BraintreeToPaymentClientInterface
154
     */
155
    public function getPaymentClient(): BraintreeToPaymentClientInterface
156
    {
157
        return $this->getProvidedDependency(BraintreeDependencyProvider::CLIENT_PAYMENT);
158
    }
159
160
    /**
161
     * @return \Spryker\Shared\Money\Dependency\Plugin\MoneyPluginInterface
162
     */
163
    public function getMoneyPlugin()
164
    {
165
        return $this->getProvidedDependency(BraintreeDependencyProvider::PLUGIN_MONEY);
166
    }
167
168
    /**
169
     * @return \Spryker\Shared\Kernel\Store
170
     */
171
    public function getStore()
172
    {
173
        return $this->getProvidedDependency(BraintreeDependencyProvider::STORE);
174
    }
175
176
    /**
177
     * @return StepEngineFormDataProviderInterface
178
     */
179
    public function createBraintreePaypalExpressShipmentFormDataProvider(): StepEngineFormDataProviderInterface
180
    {
181
        return new CheckoutShipmentFormDataProvider(
182
            $this->getShipmentClient(),
183
            $this->getGlossaryClient(),
184
            $this->getStore(),
185
            $this->getMoneyPlugin()
186
        );
187
    }
188
}
189