Conditions | 2 |
Paths | 2 |
Total Lines | 52 |
Code Lines | 42 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
16 | function aui_bs_convert_sd_output( $output, $instance = '', $args = '', $sd = '' ) { |
||
17 | global $aui_bs5; |
||
18 | |||
19 | if ( $aui_bs5 ) { |
||
20 | |||
21 | $convert = array( |
||
22 | 'ml-' => 'ms-', |
||
23 | 'mr-' => 'me-', |
||
24 | 'pl-' => 'ps-', |
||
25 | 'pr-' => 'pe-', |
||
26 | ' form-row' => ' row', |
||
27 | ' embed-responsive-item' => '', |
||
28 | ' embed-responsive' => ' ratio', |
||
29 | '-1by1' => '-1x1', |
||
30 | '-4by3' => '-4x3', |
||
31 | '-16by9' => '-16x9', |
||
32 | '-21by9' => '-21x9', |
||
33 | 'geodir-lightbox-image' => 'aui-lightbox-image', |
||
34 | ' badge-' => ' text-bg-', |
||
35 | 'form-group' => 'mb-3', |
||
36 | 'custom-select' => 'form-select', |
||
37 | 'float-left' => 'float-start', |
||
38 | 'float-right' => 'float-end', |
||
39 | 'text-left' => 'text-start', |
||
40 | 'text-right' => 'text-end', |
||
41 | 'border-right' => 'border-end', |
||
42 | 'border-left' => 'border-start', |
||
43 | 'font-weight-' => 'fw-', |
||
44 | 'btn-block' => 'w-100', |
||
45 | 'rounded-left' => 'rounded-start', |
||
46 | 'rounded-right' => 'rounded-left', |
||
47 | |||
48 | // 'custom-control custom-checkbox' => 'form-check', |
||
49 | // data |
||
50 | ' data-toggle=' => ' data-bs-toggle=', |
||
51 | 'data-ride=' => 'data-bs-ride=', |
||
52 | 'data-controlnav=' => 'data-bs-controlnav=', |
||
53 | 'data-slide=' => 'data-bs-slide=', |
||
54 | 'data-slide-to=' => 'data-bs-slide-to=', |
||
55 | 'data-target=' => 'data-bs-target=', |
||
56 | 'data-dismiss="modal"' => 'data-bs-dismiss="modal"', |
||
57 | 'class="close"' => 'class="btn-close"', |
||
58 | '<span aria-hidden="true">×</span>' => '', |
||
59 | ); |
||
60 | $output = str_replace( |
||
61 | array_keys( $convert ), |
||
62 | array_values( $convert ), |
||
63 | $output |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | return $output; |
||
68 | } |
||
71 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.