| Conditions | 8 |
| Paths | 4 |
| Total Lines | 56 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| 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 |
||
| 84 | function get_css( $colors ) { |
||
| 85 | global $customizer_colour_names; |
||
| 86 | |||
| 87 | $colors_template = array(); |
||
| 88 | |||
| 89 | foreach ( $customizer_colour_names as $key => $value ) { |
||
| 90 | $colors_template[ $key ] = ''; |
||
| 91 | } |
||
| 92 | |||
| 93 | $colors = wp_parse_args( $colors, $colors_template ); |
||
| 94 | |||
| 95 | if ( empty( $colors['banner_background_color'] ) |
||
| 96 | || empty( $colors['banner_text_color'] ) |
||
| 97 | || empty( $colors['banner_text_image_color'] ) |
||
| 98 | || empty( $colors['banner_breadcrumb_background_color'] ) |
||
| 99 | || empty( $colors['banner_breadcrumb_text_color'] ) |
||
| 100 | || empty( $colors['banner_breadcrumb_text_selected_color'] ) ) { |
||
| 101 | return ''; |
||
| 102 | } |
||
| 103 | |||
| 104 | $css = ' |
||
| 105 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/banner"; |
||
| 106 | |||
| 107 | /** |
||
| 108 | * LSX Customizer - Banner |
||
| 109 | */ |
||
| 110 | @include banner-colours ( |
||
| 111 | $bg: ' . $colors['banner_background_color'] . ', |
||
| 112 | $color: ' . $colors['banner_text_color'] . ', |
||
| 113 | $color-image: ' . $colors['banner_text_image_color'] . ', |
||
| 114 | $breadcrumb-bg: ' . $colors['banner_breadcrumb_background_color'] . ', |
||
| 115 | $breadcrumb-color: ' . $colors['banner_breadcrumb_text_color'] . ', |
||
| 116 | $breadcrumb-current: ' . $colors['banner_breadcrumb_text_selected_color'] . ' |
||
| 117 | ); |
||
| 118 | |||
| 119 | .lsx:not(.single-post) .archive-header .archive-title, .lsx:not(.single-post) .archive-header .page-title, .lsx:not(.single-post) .archive-header *, .lsx:not(.single-post) .archive-header *, .lsx:not(.single-post) .archive-header >p, .lsx:not(.single-post) .archive-header >p, .lsx:not(.single-post):not(.page-has-banner) .archive-header-wrapper .archive-header .archive-title, .lsx:not(.single-post):not(.page-has-banner) .archive-header-wrapper .archive-header>p, .lsx-layout-switcher .lsx-layout-switcher-option { |
||
| 120 | color: ' . $colors['banner_text_color'] . '; |
||
| 121 | } |
||
| 122 | |||
| 123 | .lsx:not(.single-post) .archive-header.banner-has-custom-bg .archive-title, .lsx:not(.single-post) .archive-header.banner-has-custom-bg .page-title, .lsx:not(.single-post) .archive-header.banner-has-custom-bg *, .lsx:not(.single-post) .archive-header.banner-has-custom-bg *, .lsx:not(.single-post) .archive-header.banner-has-custom-bg >p, .lsx:not(.single-post) .archive-header.banner-has-custom-bg >p, .lsx:not(.single-post):not(.page-has-banner) .archive-header-wrapper .archive-header.banner-has-custom-bg .archive-title, .lsx:not(.single-post):not(.page-has-banner) .archive-header-wrapper .archive-header.banner-has-custom-bg>p, .banner-has-custom-bg .lsx-layout-switcher .lsx-layout-switcher-option { |
||
| 124 | color: ' . $colors['banner_text_image_color'] . '; |
||
| 125 | } |
||
| 126 | .lsx-hero-banner-block { |
||
| 127 | background-color: ' . $colors['banner_background_color'] . '; |
||
| 128 | .lsx-title-block { |
||
| 129 | h1 { |
||
| 130 | color: ' . $colors['banner_text_color'] . '; |
||
| 131 | } |
||
| 132 | } |
||
| 133 | } |
||
| 134 | '; |
||
| 135 | |||
| 136 | $css = apply_filters( 'lsx_customizer_colour_selectors_banner', $css, $colors ); |
||
| 137 | $css = parent::scss_to_css( $css ); |
||
| 138 | |||
| 139 | return $css; |
||
| 140 | } |
||
| 145 |