| Conditions | 3 |
| Paths | 4 |
| Total Lines | 113 |
| 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 |
||
| 17 | public function run() |
||
| 18 | { |
||
| 19 | if (Schema::hasTable('payment_systems')) { |
||
| 20 | PaymentSystem::firstOrCreate([ |
||
| 21 | 'name' => 'Payme', |
||
| 22 | 'system' => 'payme' |
||
| 23 | ]); |
||
| 24 | PaymentSystem::firstOrCreate([ |
||
| 25 | 'name' => 'Click', |
||
| 26 | 'system' => 'click' |
||
| 27 | ]); |
||
| 28 | PaymentSystem::firstOrCreate([ |
||
| 29 | 'name' => 'Paynet', |
||
| 30 | 'system' => 'paynet' |
||
| 31 | ]); |
||
| 32 | PaymentSystem::firstOrCreate([ |
||
| 33 | 'name' => 'Stripe', |
||
| 34 | 'system' => 'stripe' |
||
| 35 | ]); |
||
| 36 | } |
||
| 37 | if (Schema::hasTable('payment_system_params')) { |
||
| 38 | //Paycom |
||
| 39 | PaymentSystemParam::firstOrCreate([ |
||
| 40 | 'system' => 'payme', |
||
| 41 | 'label' => 'Login', |
||
| 42 | 'name' => 'login', |
||
| 43 | 'value' => 'Paycom' |
||
| 44 | ]); |
||
| 45 | PaymentSystemParam::firstOrCreate([ |
||
| 46 | 'system' => 'payme', |
||
| 47 | 'label' => 'Merchant id', |
||
| 48 | 'name' => 'merchant_id', |
||
| 49 | 'value' => 'merchant' |
||
| 50 | ]); |
||
| 51 | PaymentSystemParam::firstOrCreate([ |
||
| 52 | 'system' => 'payme', |
||
| 53 | 'label' => 'Password', |
||
| 54 | 'name' => 'password', |
||
| 55 | 'value' => 'password' |
||
| 56 | ]); |
||
| 57 | PaymentSystemParam::firstOrCreate([ |
||
| 58 | 'system' => 'payme', |
||
| 59 | 'label' => 'Key', |
||
| 60 | 'name' => 'key', |
||
| 61 | 'value' => 'key' |
||
| 62 | ]); |
||
| 63 | //Click |
||
| 64 | PaymentSystemParam::firstOrCreate([ |
||
| 65 | 'system' => 'click', |
||
| 66 | 'label' => 'Service id', |
||
| 67 | 'name' => 'service_id', |
||
| 68 | 'value' => 'service_id' |
||
| 69 | ]); |
||
| 70 | PaymentSystemParam::firstOrCreate([ |
||
| 71 | 'system' => 'click', |
||
| 72 | 'label' => 'Secret key', |
||
| 73 | 'name' => 'secret_key', |
||
| 74 | 'value' => 'key' |
||
| 75 | ]); |
||
| 76 | PaymentSystemParam::firstOrCreate([ |
||
| 77 | 'system' => 'click', |
||
| 78 | 'label' => 'Merchant Id', |
||
| 79 | 'name' => 'merchant_id', |
||
| 80 | 'value' => '0000' |
||
| 81 | ]); |
||
| 82 | PaymentSystemParam::firstOrCreate([ |
||
| 83 | 'system' => 'click', |
||
| 84 | 'label' => 'Merchant user id', |
||
| 85 | 'name' => 'merchant_user_id', |
||
| 86 | 'value' => '0000' |
||
| 87 | ]); |
||
| 88 | |||
| 89 | //Paynet |
||
| 90 | PaymentSystemParam::firstOrCreate([ |
||
| 91 | 'system' => 'paynet', |
||
| 92 | 'label' => 'Login', |
||
| 93 | 'name' => 'login', |
||
| 94 | 'value' => 'login' |
||
| 95 | ]); |
||
| 96 | PaymentSystemParam::firstOrCreate([ |
||
| 97 | 'system' => 'paynet', |
||
| 98 | 'label' => 'Password', |
||
| 99 | 'name' => 'password', |
||
| 100 | 'value' => 'password' |
||
| 101 | ]); |
||
| 102 | PaymentSystemParam::firstOrCreate([ |
||
| 103 | 'system' => 'paynet', |
||
| 104 | 'label' => 'Service id', |
||
| 105 | 'name' => 'service_id', |
||
| 106 | 'value' => 'service_id' |
||
| 107 | ]); |
||
| 108 | |||
| 109 | PaymentSystemParam::firstOrCreate([ |
||
| 110 | 'system' => 'stripe', |
||
| 111 | 'label' => 'Secret key', |
||
| 112 | 'name' => 'secret_key', |
||
| 113 | 'value' => 'secret_key' |
||
| 114 | ]); |
||
| 115 | |||
| 116 | PaymentSystemParam::firstOrCreate([ |
||
| 117 | 'system' => 'stripe', |
||
| 118 | 'label' => 'Publishable key', |
||
| 119 | 'name' => 'publishable_key', |
||
| 120 | 'value' => 'publishable_key' |
||
| 121 | ]); |
||
| 122 | PaymentSystemParam::firstOrCreate([ |
||
| 123 | 'system' => 'stripe', |
||
| 124 | 'label' => 'Proxy', |
||
| 125 | 'name' => 'proxy', |
||
| 126 | 'value' => '' |
||
| 127 | ]); |
||
| 128 | } |
||
| 129 | } |
||
| 130 | } |
||
| 131 |