Conditions | 17 |
Paths | 4 |
Total Lines | 58 |
Code Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | 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 |
||
99 | function get_css( $colors ) { |
||
100 | global $customizer_colour_names; |
||
101 | |||
102 | $colors_template = array(); |
||
103 | |||
104 | foreach ( $customizer_colour_names as $key => $value ) { |
||
105 | $colors_template[ $key ] = ''; |
||
106 | } |
||
107 | |||
108 | $colors = wp_parse_args( $colors, $colors_template ); |
||
109 | |||
110 | if ( empty( $colors['background_color'] ) |
||
111 | || empty( $colors['body_line_color'] ) |
||
112 | || empty( $colors['body_text_heading_color'] ) |
||
113 | || empty( $colors['body_text_color'] ) |
||
114 | || empty( $colors['body_link_color'] ) |
||
115 | || empty( $colors['body_link_hover_color'] ) |
||
116 | || empty( $colors['body_text_small_color'] ) |
||
117 | || empty( $colors['body_section_full_background_color'] ) |
||
118 | || empty( $colors['body_section_full_text_color'] ) |
||
119 | || empty( $colors['body_section_full_link_color'] ) |
||
120 | || empty( $colors['body_section_full_link_hover_color'] ) |
||
121 | || empty( $colors['body_section_full_cta_background_color'] ) |
||
122 | || empty( $colors['body_section_full_cta_text_color'] ) |
||
123 | || empty( $colors['body_section_full_cta_link_color'] ) |
||
124 | || empty( $colors['body_section_full_cta_link_hover_color'] ) ) { |
||
125 | return ''; |
||
126 | } |
||
127 | |||
128 | $css = ' |
||
129 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/content"; |
||
130 | |||
131 | /** |
||
132 | * LSX Customizer - Body |
||
133 | */ |
||
134 | @include content-colours ( |
||
135 | $bg: ' . $colors['background_color'] . ', |
||
136 | $breaker: ' . $colors['body_line_color'] . ', |
||
137 | $header: ' . $colors['body_text_heading_color'] . ', |
||
138 | $color: ' . $colors['body_text_color'] . ', |
||
139 | $link: ' . $colors['body_link_color'] . ', |
||
140 | $hover: ' . $colors['body_link_hover_color'] . ', |
||
141 | $small: ' . $colors['body_text_small_color'] . ', |
||
142 | $full-bg: ' . $colors['body_section_full_background_color'] . ', |
||
143 | $full-color: ' . $colors['body_section_full_text_color'] . ', |
||
144 | $full-link: ' . $colors['body_section_full_link_color'] . ', |
||
145 | $full-hover: ' . $colors['body_section_full_link_hover_color'] . ', |
||
146 | $full-cta-bg: ' . $colors['body_section_full_cta_background_color'] . ', |
||
147 | $full-cta-color: ' . $colors['body_section_full_cta_text_color'] . ', |
||
148 | $full-cta-link: ' . $colors['body_section_full_cta_link_color'] . ', |
||
149 | $full-cta-hover: ' . $colors['body_section_full_cta_link_hover_color'] . ' |
||
150 | ); |
||
151 | '; |
||
152 | |||
153 | $css = apply_filters( 'lsx_customizer_colour_selectors_body', $css, $colors ); |
||
154 | $css = parent::scss_to_css( $css ); |
||
155 | |||
156 | return $css; |
||
157 | } |
||
162 |