Conditions | 11 |
Paths | 4 |
Total Lines | 46 |
Code Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
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 |
||
87 | function get_css( $colors ) { |
||
88 | global $customizer_colour_names; |
||
89 | |||
90 | $colors_template = array(); |
||
91 | |||
92 | foreach ( $customizer_colour_names as $key => $value ) { |
||
93 | $colors_template[ $key ] = ''; |
||
94 | } |
||
95 | |||
96 | $colors = wp_parse_args( $colors, $colors_template ); |
||
97 | |||
98 | if ( empty( $colors['top_menu_background_color'] ) |
||
99 | || empty( $colors['top_menu_link_color'] ) |
||
100 | || empty( $colors['top_menu_link_hover_color'] ) |
||
101 | || empty( $colors['top_menu_icon_color'] ) |
||
102 | || empty( $colors['top_menu_icon_hover_color'] ) |
||
103 | || empty( $colors['top_menu_dropdown_color'] ) |
||
104 | || empty( $colors['top_menu_dropdown_hover_color'] ) |
||
105 | || empty( $colors['top_menu_dropdown_link_color'] ) |
||
106 | || empty( $colors['top_menu_dropdown_link_hover_color'] ) ) { |
||
107 | return ''; |
||
108 | } |
||
109 | |||
110 | $css = ' |
||
111 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/top-menu"; |
||
112 | |||
113 | /** |
||
114 | * LSX Customizer - Top Menu |
||
115 | */ |
||
116 | @include top-menu-colours ( |
||
117 | $bg: ' . $colors['top_menu_background_color'] . ', |
||
118 | $link: ' . $colors['top_menu_link_color'] . ', |
||
119 | $hover: ' . $colors['top_menu_link_hover_color'] . ', |
||
120 | $icon: ' . $colors['top_menu_icon_color'] . ', |
||
121 | $icon-hover: ' . $colors['top_menu_icon_hover_color'] . ', |
||
122 | $dropdown: ' . $colors['top_menu_dropdown_color'] . ', |
||
123 | $dropdown-hover: ' . $colors['top_menu_dropdown_hover_color'] . ', |
||
124 | $dropdown-link: ' . $colors['top_menu_dropdown_link_color'] . ', |
||
125 | $dropdown-link-hover: ' . $colors['top_menu_dropdown_link_hover_color'] . ' |
||
126 | ); |
||
127 | '; |
||
128 | |||
129 | $css = apply_filters( 'lsx_customizer_colour_selectors_top_menu', $css, $colors ); |
||
130 | $css = parent::scss_to_css( $css ); |
||
131 | |||
132 | return $css; |
||
133 | } |
||
138 |