| Conditions | 1 |
| Paths | 1 |
| Total Lines | 156 |
| Code Lines | 104 |
| 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 |
||
| 26 | public function get(): array { |
||
| 27 | return [ |
||
| 28 | |||
| 29 | 'Mail_Contact_Confirm_to_User.txt.twig' => [ |
||
| 30 | 'context' => [] |
||
| 31 | ], |
||
| 32 | |||
| 33 | 'Mail_Contact_Forward_to_Operator.txt.twig' => [ |
||
| 34 | 'context' => [ |
||
| 35 | 'firstName' => 'John', |
||
| 36 | 'lastName' => 'Doe', |
||
| 37 | 'emailAddress' => '[email protected]', |
||
| 38 | 'subject' => 'Missing Link', |
||
| 39 | 'message' => 'Please advise', |
||
| 40 | ], |
||
| 41 | ], |
||
| 42 | |||
| 43 | 'Mail_Donation_Cancellation_Confirmation.txt.twig' => [ |
||
| 44 | 'context' => [ |
||
| 45 | 'greeting_generator' => $this->factory->getGreetingGenerator(), |
||
| 46 | 'recipient' => [ |
||
| 47 | 'lastName' => "O'Reilly", |
||
| 48 | 'salutation' => 'Herr', |
||
| 49 | 'title' => 'Dr.' |
||
| 50 | ], |
||
| 51 | 'donationId' => 42 |
||
| 52 | ] |
||
| 53 | ], |
||
| 54 | |||
| 55 | 'Mail_Donation_Confirmation.txt.twig' => [ |
||
| 56 | 'context' => [ |
||
| 57 | 'greeting_generator' => $this->factory->getGreetingGenerator(), |
||
| 58 | 'donation' => [ |
||
| 59 | 'id' => 42, |
||
| 60 | 'amount' => 12.34, |
||
| 61 | 'needsModeration' => false, |
||
| 62 | ], |
||
| 63 | 'recipient' => [ |
||
| 64 | 'lastName' => '姜', |
||
| 65 | 'salutation' => 'Frau', |
||
| 66 | 'title' => '' |
||
| 67 | ], |
||
| 68 | ], |
||
| 69 | 'variants' => [ |
||
| 70 | 'deposit_unmoderated_non_recurring' => [ |
||
| 71 | 'donation' => [ |
||
| 72 | 'paymentType' => 'UEB', |
||
| 73 | 'interval' => 0, |
||
| 74 | 'bankTransferCode' => 'WZF3984Y', |
||
| 75 | ] |
||
| 76 | ], |
||
| 77 | 'direct_debit_unmoderated_non_recurring' => [ |
||
| 78 | 'donation' => [ |
||
| 79 | 'paymentType' => 'BEZ', |
||
| 80 | 'interval' => 0, |
||
| 81 | ] |
||
| 82 | ], |
||
| 83 | 'direct_debit_unmoderated_recurring' => [ |
||
| 84 | 'donation' => [ |
||
| 85 | 'paymentType' => 'BEZ', |
||
| 86 | 'interval' => 3, |
||
| 87 | ] |
||
| 88 | ], |
||
| 89 | 'paypal_unmoderated_non_recurring' => [ |
||
| 90 | 'donation' => [ |
||
| 91 | 'paymentType' => 'PPL', |
||
| 92 | 'interval' => 0, |
||
| 93 | ] |
||
| 94 | ], |
||
| 95 | // PPL and MCP follow the same code path for recurring, no need to test each separately |
||
| 96 | 'micropayment_unmoderated_recurring' => [ |
||
| 97 | 'donation' => [ |
||
| 98 | 'paymentType' => 'MCP', |
||
| 99 | 'interval' => 6, |
||
| 100 | ] |
||
| 101 | ], |
||
| 102 | // moderated all generate the same message, no need to test different payment types |
||
| 103 | 'micropayment_moderated_recurring' => [ |
||
| 104 | 'donation' => [ |
||
| 105 | 'needsModeration' => true, |
||
| 106 | 'paymentType' => 'MCP', |
||
| 107 | 'interval' => 6 |
||
| 108 | ], |
||
| 109 | ] |
||
| 110 | ], |
||
| 111 | ], |
||
| 112 | |||
| 113 | 'Mail_Membership_Application_Cancellation_Confirmation.txt.twig' => [ |
||
| 114 | 'context' => [ |
||
| 115 | 'greeting_generator' => $this->factory->getGreetingGenerator(), |
||
| 116 | 'membershipApplicant' => [ |
||
| 117 | 'lastName' => "O'Reilly", |
||
| 118 | 'salutation' => 'Herr', |
||
| 119 | 'title' => 'Dr.' |
||
| 120 | ], |
||
| 121 | 'applicationId' => 23 |
||
| 122 | ] |
||
| 123 | ], |
||
| 124 | |||
| 125 | 'Mail_Membership_Application_Confirmation.txt.twig' => [ |
||
| 126 | 'context' => [ |
||
| 127 | 'greeting_generator' => $this->factory->getGreetingGenerator(), |
||
| 128 | 'lastName' => "O'Reilly", |
||
| 129 | 'salutation' => 'Herr', |
||
| 130 | 'title' => 'Dr.', |
||
| 131 | 'membershipFee' => 15.23, |
||
| 132 | ], |
||
| 133 | 'variants' => [ |
||
| 134 | 'direct_debit_active_yearly' => [ |
||
| 135 | 'membershipType' => 'active', |
||
| 136 | 'paymentIntervalInMonths' => 12, |
||
| 137 | 'paymentType' => 'BEZ', |
||
| 138 | ], |
||
| 139 | 'direct_debit_sustaining_quarterly' => [ |
||
| 140 | 'membershipType' => 'sustaining', |
||
| 141 | 'paymentIntervalInMonths' => 3, |
||
| 142 | 'paymentType' => 'BEZ', |
||
| 143 | ], |
||
| 144 | 'paypal_sustaining_monthly' => [ |
||
| 145 | 'membershipType' => 'sustaining', |
||
| 146 | 'paymentIntervalInMonths' => 1, |
||
| 147 | 'paymentType' => 'PPL', |
||
| 148 | ] |
||
| 149 | ] |
||
| 150 | ], |
||
| 151 | |||
| 152 | 'Mail_Subscription_Confirmation.txt.twig' => [ |
||
| 153 | 'context' => [ |
||
| 154 | 'greeting_generator' => $this->factory->getGreetingGenerator(), |
||
| 155 | 'subscription' => [ |
||
| 156 | 'email' => '[email protected]', |
||
| 157 | 'address' => [ |
||
| 158 | 'lastName' => "O'Reilly", |
||
| 159 | 'salutation' => 'Herr', |
||
| 160 | 'title' => 'Dr.' |
||
| 161 | ] |
||
| 162 | ] |
||
| 163 | ] |
||
| 164 | ], |
||
| 165 | |||
| 166 | 'Mail_Subscription_Request.txt.twig' => [ |
||
| 167 | 'context' => [ |
||
| 168 | 'greeting_generator' => $this->factory->getGreetingGenerator(), |
||
| 169 | 'subscription' => [ |
||
| 170 | 'email' => '[email protected]', |
||
| 171 | 'confirmationCode' => '00deadbeef', |
||
| 172 | 'address' => [ |
||
| 173 | 'lastName' => "O'Reilly", |
||
| 174 | 'salutation' => 'Herr', |
||
| 175 | 'title' => 'Dr.' |
||
| 176 | ] |
||
| 177 | ] |
||
| 178 | ] |
||
| 179 | ], |
||
| 180 | ]; |
||
| 181 | } |
||
| 182 | } |
||
| 183 |