HeidelpayControllerProvider::defineControllers()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 80
Code Lines 60

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 60
dl 0
loc 80
c 0
b 0
f 0
rs 8.8727
cc 1
nc 1
nop 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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\Heidelpay\Plugin\Provider;
9
10
use Silex\Application;
11
use SprykerShop\Yves\ShopApplication\Plugin\Provider\AbstractYvesControllerProvider;
12
13
class HeidelpayControllerProvider extends AbstractYvesControllerProvider
0 ignored issues
show
Deprecated Code introduced by
The class SprykerShop\Yves\ShopApp...tYvesControllerProvider has been deprecated: Use {@link \Spryker\Yves\Router\Plugin\RouteProvider\AbstractRouteProviderPlugin} instead. ( Ignorable by Annotation )

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

13
class HeidelpayControllerProvider extends /** @scrutinizer ignore-deprecated */ AbstractYvesControllerProvider
Loading history...
14
{
15
    public const HEIDELPAY_PAYMENT = 'heidelpay-payment';
16
    public const HEIDELPAY_EASY_CREDIT_PAYMENT = 'heidelpay-easy-credit-payment';
17
    public const HEIDELPAY_EASY_CREDIT_INITIALIZE_PAYMENT = 'heidelpay-easy-credit-initialize-payment';
18
    public const HEIDELPAY_PAYMENT_FAILED = 'heidelpay-payment-failed';
19
    public const HEIDELPAY_IDEAL_AUTHORIZE = 'heidelpay-ideal-authorize';
20
    public const HEIDELPAY_CREDIT_CARD_REGISTER = 'heidelpay-cc-register';
21
    public const HEIDELPAY_CREDIT_CARD_REGISTER_SUCCESS = 'heidelpay-cc-register-success';
22
    public const HEIDELPAY_NOTIFICATION = 'heidelpay-notification';
23
    public const HEIDELPAY_DIRECT_DEBIT_REGISTER = 'heidelpay-dd-register';
24
    public const HEIDELPAY_DIRECT_DEBIT_REGISTER_SUCCESS = 'heidelpay-dd-register-success';
25
26
    /**
27
     * @param \Silex\Application $app
28
     *
29
     * @return void
30
     */
31
    protected function defineControllers(Application $app): void
32
    {
33
        $this->createController(
34
            '/heidelpay/payment-failed',
35
            static::HEIDELPAY_PAYMENT_FAILED,
36
            'Heidelpay',
37
            'Heidelpay',
38
            'paymentFailed'
39
        );
40
41
        $this->createController(
42
            '/heidelpay/payment',
43
            static::HEIDELPAY_PAYMENT,
44
            'Heidelpay',
45
            'Heidelpay',
46
            'payment'
47
        );
48
49
        $this->createController(
50
            '/heidelpay/easyCreditPayment',
51
            static::HEIDELPAY_EASY_CREDIT_PAYMENT,
52
            'Heidelpay',
53
            'EasyCredit',
54
            'easyCreditPayment'
55
        );
56
57
        $this->createController(
58
            '/heidelpay/easyCreditInitializePayment',
59
            static::HEIDELPAY_EASY_CREDIT_INITIALIZE_PAYMENT,
60
            'Heidelpay',
61
            'EasyCredit',
62
            'easyCreditInitializePayment'
63
        );
64
65
        $this->createController(
66
            '/heidelpay/ideal-authorize',
67
            static::HEIDELPAY_IDEAL_AUTHORIZE,
68
            'Heidelpay',
69
            'Ideal',
70
            'authorize'
71
        );
72
73
        $this->createController(
74
            '/heidelpay/cc-register-response',
75
            static::HEIDELPAY_CREDIT_CARD_REGISTER,
76
            'Heidelpay',
77
            'CreditCard',
78
            'registrationRequest'
79
        );
80
81
        $this->createController(
82
            '/heidelpay/cc-register-success',
83
            static::HEIDELPAY_CREDIT_CARD_REGISTER_SUCCESS,
84
            'Heidelpay',
85
            'CreditCard',
86
            'registrationSuccess'
87
        );
88
89
        $this->createPostController(
90
            '/heidelpay/notification',
91
            static::HEIDELPAY_NOTIFICATION,
92
            'Heidelpay',
93
            'Notification',
94
            'index'
95
        );
96
97
        $this->createPostController(
98
            '/heidelpay/dd-register-response',
99
            static::HEIDELPAY_DIRECT_DEBIT_REGISTER,
100
            'Heidelpay',
101
            'DirectDebit',
102
            'registrationRequest'
103
        );
104
105
        $this->createController(
106
            '/heidelpay/dd-register-success',
107
            static::HEIDELPAY_DIRECT_DEBIT_REGISTER_SUCCESS,
108
            'Heidelpay',
109
            'DirectDebit',
110
            'registrationSuccess'
111
        );
112
    }
113
}
114