Conditions | 1 |
Paths | 1 |
Total Lines | 61 |
Code Lines | 43 |
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 |
||
63 | public function get_dummy_preview( $args ) { |
||
|
|||
64 | $output = '<form><div class="col-12">'; |
||
65 | |||
66 | $output .= aui()->alert( |
||
67 | array( |
||
68 | 'type'=> 'info', |
||
69 | 'content' => __( 'This is a simple preview for a checkout form.', 'invoicing' ) |
||
70 | ) |
||
71 | ); |
||
72 | |||
73 | $output .= aui()->input( |
||
74 | array( |
||
75 | 'name' => 'mmdwqzpox', |
||
76 | 'required' => true, |
||
77 | 'label' => __( 'Billing Email', 'invoicing' ), |
||
78 | 'label_type' => 'vertical', |
||
79 | 'type' => 'text', |
||
80 | 'placeholder' => '[email protected]', |
||
81 | 'class' => '', |
||
82 | 'value' => '' |
||
83 | ) |
||
84 | ); |
||
85 | |||
86 | $output .= aui()->input( |
||
87 | array( |
||
88 | 'name' => 'mmdwqzpoy', |
||
89 | 'required' => true, |
||
90 | 'label' => __( 'First Name', 'invoicing' ), |
||
91 | 'label_type' => 'vertical', |
||
92 | 'type' => 'text', |
||
93 | 'placeholder' => 'Jon', |
||
94 | 'class' => '', |
||
95 | 'value' => '' |
||
96 | ) |
||
97 | ); |
||
98 | |||
99 | $output .= aui()->input( |
||
100 | array( |
||
101 | 'name' => 'mmdwqzpoz', |
||
102 | 'required' => true, |
||
103 | 'label' => __( 'Last Name', 'invoicing' ), |
||
104 | 'label_type' => 'vertical', |
||
105 | 'type' => 'text', |
||
106 | 'placeholder' => 'Snow', |
||
107 | 'class' => '', |
||
108 | 'value' => '' |
||
109 | ) |
||
110 | ); |
||
111 | |||
112 | $output .= aui()->button( |
||
113 | array( |
||
114 | 'type' => 'button', |
||
115 | 'class' => 'btn btn-primary w-100', |
||
116 | 'content' => __( 'Pay Now »', 'invoicing' ), |
||
117 | 'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ) |
||
118 | ) |
||
119 | ); |
||
120 | |||
121 | $output .= '</div></form>'; |
||
122 | |||
123 | return $output; |
||
124 | } |
||
126 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.