Conditions | 1 |
Paths | 1 |
Total Lines | 75 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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:
If many parameters/temporary variables are present:
1 | <?php |
||
32 | public function factoryProvider() |
||
33 | { |
||
34 | return [ |
||
35 | [ |
||
36 | 'notificationType' => 'user_validation', |
||
37 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\UserValidationMessage', |
||
38 | 'isUserValidation' => true, |
||
39 | 'isPayment' => false, |
||
40 | 'isRefund' => false, |
||
41 | ], |
||
42 | [ |
||
43 | 'notificationType' => 'payment', |
||
44 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\PaymentMessage', |
||
45 | 'isUserValidation' => false, |
||
46 | 'isPayment' => true, |
||
47 | 'isRefund' => false, |
||
48 | ], |
||
49 | [ |
||
50 | 'notificationType' => 'refund', |
||
51 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\RefundMessage', |
||
52 | 'isUserValidation' => false, |
||
53 | 'isPayment' => false, |
||
54 | 'isRefund' => true, |
||
55 | ], |
||
56 | [ |
||
57 | 'notificationType' => 'afs_reject', |
||
58 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\AfsRejectMessage', |
||
59 | 'isUserValidation' => false, |
||
60 | 'isPayment' => false, |
||
61 | 'isRefund' => false, |
||
62 | ], |
||
63 | [ |
||
64 | 'notificationType' => 'create_subscription', |
||
65 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\CreateSubscriptionMessage', |
||
66 | 'isUserValidation' => false, |
||
67 | 'isPayment' => false, |
||
68 | 'isRefund' => false, |
||
69 | ], |
||
70 | [ |
||
71 | 'notificationType' => 'cancel_subscription', |
||
72 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\CancelSubscriptionMessage', |
||
73 | 'isUserValidation' => false, |
||
74 | 'isPayment' => false, |
||
75 | 'isRefund' => false, |
||
76 | ], |
||
77 | [ |
||
78 | 'notificationType' => 'update_subscription', |
||
79 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\UpdateSubscriptionMessage', |
||
80 | 'isUserValidation' => false, |
||
81 | 'isPayment' => false, |
||
82 | 'isRefund' => false, |
||
83 | ], |
||
84 | [ |
||
85 | 'notificationType' => 'user_balance_operation', |
||
86 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\UserBalanceMessage', |
||
87 | 'isUserValidation' => false, |
||
88 | 'isPayment' => false, |
||
89 | 'isRefund' => false, |
||
90 | ], |
||
91 | [ |
||
92 | 'notificationType' => 'get_pincode', |
||
93 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\GetPinCodeMessage', |
||
94 | 'isUserValidation' => false, |
||
95 | 'isPayment' => false, |
||
96 | 'isRefund' => false, |
||
97 | ], |
||
98 | [ |
||
99 | 'notificationType' => 'user_search', |
||
100 | 'expectedClass' => '\Xsolla\SDK\Webhook\Message\UserSearchMessage', |
||
101 | 'isUserValidation' => false, |
||
102 | 'isPayment' => false, |
||
103 | 'isRefund' => false, |
||
104 | ], |
||
105 | ]; |
||
106 | } |
||
107 | } |
||
108 |