| Conditions | 6 |
| Paths | 16 |
| Total Lines | 184 |
| Code Lines | 27 |
| 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 |
||
| 161 | public function getHeader( $uid = '' ) |
||
| 162 | { |
||
| 163 | $view = $this->getObject()->addData( $this->getView() ); |
||
| 164 | |||
| 165 | $content = ''; |
||
| 166 | foreach( $this->getSubClients() as $subclient ) { |
||
| 167 | $content .= $subclient->setView( $view )->getHeader( $uid ); |
||
| 168 | } |
||
| 169 | $view->paymentHeader = $content; |
||
| 170 | |||
| 171 | |||
| 172 | $addr = $view->extAddressItem; |
||
| 173 | |||
| 174 | $msg = $view->mail(); |
||
| 175 | $msg->addHeader( 'X-MailGenerator', 'Aimeos' ); |
||
| 176 | $msg->addTo( $addr->getEMail(), $addr->getFirstName() . ' ' . $addr->getLastName() ); |
||
| 177 | |||
| 178 | |||
| 179 | /** client/html/email/from-name |
||
| 180 | * @see client/html/email/payment/from-email |
||
| 181 | */ |
||
| 182 | $fromName = $view->config( 'client/html/email/from-name' ); |
||
| 183 | |||
| 184 | /** client/html/email/payment/from-name |
||
| 185 | * Name used when sending payment e-mails |
||
| 186 | * |
||
| 187 | * The name of the person or e-mail account that is used for sending all |
||
| 188 | * shop related payment e-mails to customers. This configuration option |
||
| 189 | * overwrite the name set in "client/html/email/from-name". |
||
| 190 | * |
||
| 191 | * @param string Name shown in the e-mail |
||
| 192 | * @since 2014.03 |
||
| 193 | * @category User |
||
| 194 | * @see client/html/email/from-name |
||
| 195 | * @see client/html/email/from-email |
||
| 196 | * @see client/html/email/reply-email |
||
| 197 | * @see client/html/email/bcc-email |
||
| 198 | */ |
||
| 199 | $fromNamePayment = $view->config( 'client/html/email/payment/from-name', $fromName ); |
||
| 200 | |||
| 201 | /** client/html/email/from-email |
||
| 202 | * @see client/html/email/payment/from-email |
||
| 203 | */ |
||
| 204 | $fromEmail = $view->config( 'client/html/email/from-email' ); |
||
| 205 | |||
| 206 | /** client/html/email/payment/from-email |
||
| 207 | * E-Mail address used when sending payment e-mails |
||
| 208 | * |
||
| 209 | * The e-mail address of the person or account that is used for sending |
||
| 210 | * all shop related payment emails to customers. This configuration option |
||
| 211 | * overwrites the e-mail address set via "client/html/email/from-email". |
||
| 212 | * |
||
| 213 | * @param string E-mail address |
||
| 214 | * @since 2014.03 |
||
| 215 | * @category User |
||
| 216 | * @see client/html/email/payment/from-name |
||
| 217 | * @see client/html/email/from-email |
||
| 218 | * @see client/html/email/reply-email |
||
| 219 | * @see client/html/email/bcc-email |
||
| 220 | */ |
||
| 221 | if( ( $fromEmailPayment = $view->config( 'client/html/email/payment/from-email', $fromEmail ) ) != null ) { |
||
| 222 | $msg->addFrom( $fromEmailPayment, $fromNamePayment ); |
||
| 223 | } |
||
| 224 | |||
| 225 | |||
| 226 | /** client/html/email/reply-name |
||
| 227 | * @see client/html/email/payment/reply-email |
||
| 228 | */ |
||
| 229 | $replyName = $view->config( 'client/html/email/reply-name', $fromName ); |
||
| 230 | |||
| 231 | /** client/html/email/payment/reply-name |
||
| 232 | * Recipient name displayed when the customer replies to payment e-mails |
||
| 233 | * |
||
| 234 | * The name of the person or e-mail account the customer should |
||
| 235 | * reply to in case of payment related questions or problems. This |
||
| 236 | * configuration option overwrites the name set via |
||
| 237 | * "client/html/email/reply-name". |
||
| 238 | * |
||
| 239 | * @param string Name shown in the e-mail |
||
| 240 | * @since 2014.03 |
||
| 241 | * @category User |
||
| 242 | * @see client/html/email/payment/reply-email |
||
| 243 | * @see client/html/email/reply-name |
||
| 244 | * @see client/html/email/reply-email |
||
| 245 | * @see client/html/email/from-email |
||
| 246 | * @see client/html/email/bcc-email |
||
| 247 | */ |
||
| 248 | $replyNamePayment = $view->config( 'client/html/email/payment/reply-name', $replyName ); |
||
| 249 | |||
| 250 | /** client/html/email/reply-email |
||
| 251 | * @see client/html/email/payment/reply-email |
||
| 252 | */ |
||
| 253 | $replyEmail = $view->config( 'client/html/email/reply-email', $fromEmail ); |
||
| 254 | |||
| 255 | /** client/html/email/payment/reply-email |
||
| 256 | * E-Mail address used by the customer when replying to payment e-mails |
||
| 257 | * |
||
| 258 | * The e-mail address of the person or e-mail account the customer |
||
| 259 | * should reply to in case of payment related questions or problems. |
||
| 260 | * This configuration option overwrites the e-mail address set via |
||
| 261 | * "client/html/email/reply-email". |
||
| 262 | * |
||
| 263 | * @param string E-mail address |
||
| 264 | * @since 2014.03 |
||
| 265 | * @category User |
||
| 266 | * @see client/html/email/payment/reply-name |
||
| 267 | * @see client/html/email/reply-email |
||
| 268 | * @see client/html/email/from-email |
||
| 269 | * @see client/html/email/bcc-email |
||
| 270 | */ |
||
| 271 | if( ( $replyEmailPayment = $view->config( 'client/html/email/payment/reply-email', $replyEmail ) ) != null ) { |
||
| 272 | $msg->addReplyTo( $replyEmailPayment, $replyNamePayment ); |
||
| 273 | } |
||
| 274 | |||
| 275 | |||
| 276 | /** client/html/email/bcc-email |
||
| 277 | * @see client/html/email/payment/bcc-email |
||
| 278 | */ |
||
| 279 | $bccEmail = $view->config( 'client/html/email/bcc-email' ); |
||
| 280 | |||
| 281 | /** client/html/email/payment/bcc-email |
||
| 282 | * E-Mail address all payment e-mails should be also sent to |
||
| 283 | * |
||
| 284 | * Using this option you can send a copy of all payment related e-mails |
||
| 285 | * to a second e-mail account. This can be handy for testing and checking |
||
| 286 | * the e-mails sent to customers. |
||
| 287 | * |
||
| 288 | * It also allows shop owners with a very small volume of orders to be |
||
| 289 | * notified about payment changes. Be aware that this isn't useful if the |
||
| 290 | * order volumne is high or has peeks! |
||
| 291 | * |
||
| 292 | * This configuration option overwrites the e-mail address set via |
||
| 293 | * "client/html/email/bcc-email". |
||
| 294 | * |
||
| 295 | * @param string|array E-mail address or list of e-mail addresses |
||
| 296 | * @since 2014.03 |
||
| 297 | * @category User |
||
| 298 | * @category Developer |
||
| 299 | * @see client/html/email/bcc-email |
||
| 300 | * @see client/html/email/reply-email |
||
| 301 | * @see client/html/email/from-email |
||
| 302 | */ |
||
| 303 | if( ( $bccEmailPayment = $view->config( 'client/html/email/payment/bcc-email', $bccEmail ) ) != null ) |
||
| 304 | { |
||
| 305 | foreach( (array) $bccEmailPayment as $emailAddr ) { |
||
| 306 | $msg->addBcc( $emailAddr ); |
||
| 307 | } |
||
| 308 | } |
||
| 309 | |||
| 310 | |||
| 311 | /** client/html/email/payment/standard/template-header |
||
| 312 | * Relative path to the HTML header template of the email payment client. |
||
| 313 | * |
||
| 314 | * The template file contains the HTML code and processing instructions |
||
| 315 | * to generate the HTML code that is inserted into the HTML page header |
||
| 316 | * of the rendered page in the frontend. The configuration string is the |
||
| 317 | * path to the template file relative to the templates directory (usually |
||
| 318 | * in client/html/templates). |
||
| 319 | * |
||
| 320 | * You can overwrite the template file configuration in extensions and |
||
| 321 | * provide alternative templates. These alternative templates should be |
||
| 322 | * named like the default one but with the string "standard" replaced by |
||
| 323 | * an unique name. You may use the name of your project for this. If |
||
| 324 | * you've implemented an alternative client class as well, "standard" |
||
| 325 | * should be replaced by the name of the new class. |
||
| 326 | * |
||
| 327 | * The email payment HTML client allows to use a different template for |
||
| 328 | * each payment status value. You can create a template for each payment |
||
| 329 | * status and store it in the "email/payment/<status number>/" directory |
||
| 330 | * below the "templates" directory (usually in client/html/templates). If no |
||
| 331 | * specific layout template is found, the common template in the |
||
| 332 | * "email/payment/" directory is used. |
||
| 333 | * |
||
| 334 | * @param string Relative path to the template creating code for the HTML page head |
||
| 335 | * @since 2014.03 |
||
| 336 | * @category Developer |
||
| 337 | * @see client/html/email/payment/standard/template-body |
||
| 338 | */ |
||
| 339 | $tplconf = 'client/html/email/payment/standard/template-header'; |
||
| 340 | |||
| 341 | $status = $view->extOrderItem->getPaymentStatus(); |
||
| 342 | $default = array( 'email/payment/' . $status . '/header-standard', 'email/payment/header-standard' ); |
||
| 343 | |||
| 344 | return $view->render( $view->config( $tplconf, $default ) ); ; |
||
| 345 | } |
||
| 523 | } |