dimanche 4 décembre 2016

Function parameter styling

I have a function that has a long parameter. What is the proper way to style the parameters of the function?

Example 1:

        public function sendMail( $mail_recipients,
                                  $mail_subject,
                                  $mail_message,
                                  $mail_sender,
                                  $mail_cc_recipients = null,
                                  $mail_bcc_recipients = null )

vs

Example 2:

public function sendMail( $mail_recipients, $mail_subject, $mail_message, $mail_sender, $mail_cc_recipients = null, $mail_bcc_recipients = null )

The calling part:

$this->sendMail( 'test', 'test', 'test', 'test' );

$this->sendMail( 'test',
                 'test',
                 'test',
                 'test );

Which one is applicable?

I'm practicing the 80 line code limit




Aucun commentaire:

Enregistrer un commentaire