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