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