| Conditions | 3 |
| Paths | 3 |
| Total Lines | 72 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 80 | function lsx_scripts_add_fonts() { |
||
| 81 | |||
| 82 | $disable_fonts = get_theme_mod( 'lsx_disable_fonts', false ); |
||
| 83 | if ( false !== $disable_fonts ) { |
||
| 84 | return; |
||
| 85 | } |
||
| 86 | |||
| 87 | // Font styles. |
||
| 88 | $font_styles = ' |
||
| 89 | @font-face { |
||
| 90 | font-family: \'Lora\'; |
||
| 91 | font-style: normal; |
||
| 92 | font-weight: 400; |
||
| 93 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/lora/Lora-Regular.ttf" ) format("truetype"); |
||
| 94 | } |
||
| 95 | @font-face { |
||
| 96 | font-family: \'Lora\'; |
||
| 97 | font-style: italic; |
||
| 98 | font-weight: 400i; |
||
| 99 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/lora/Lora-Italic.ttf" ) format("truetype"); |
||
| 100 | } |
||
| 101 | @font-face { |
||
| 102 | font-family: \'Lora\'; |
||
| 103 | font-style: normal; |
||
| 104 | font-weight: 700; |
||
| 105 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/lora/Lora-Bold.ttf" ) format("truetype"); |
||
| 106 | } |
||
| 107 | @font-face { |
||
| 108 | font-family: \'Lora\'; |
||
| 109 | font-style: italic; |
||
| 110 | font-weight: 700i; |
||
| 111 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/lora/Lora-BoldItalic.ttf" ) format("truetype"); |
||
| 112 | } |
||
| 113 | @font-face { |
||
| 114 | font-family: \'Noto Sans\'; |
||
| 115 | font-style: normal; |
||
| 116 | font-weight: 400; |
||
| 117 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/noto_sans/NotoSans-Regular.ttf" ) format("truetype"); |
||
| 118 | } |
||
| 119 | @font-face { |
||
| 120 | font-family: \'Noto Sans\'; |
||
| 121 | font-style: italic; |
||
| 122 | font-weight: 400i; |
||
| 123 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/noto_sans/NotoSans-Italic.ttf" ) format("truetype"); |
||
| 124 | } |
||
| 125 | @font-face { |
||
| 126 | font-family: \'Noto Sans\'; |
||
| 127 | font-style: normal; |
||
| 128 | font-weight: 700; |
||
| 129 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/noto_sans/NotoSans-Bold.ttf" ) format("truetype"); |
||
| 130 | } |
||
| 131 | @font-face { |
||
| 132 | font-family: \'Noto Sans\'; |
||
| 133 | font-style: italic; |
||
| 134 | font-weight: 700i; |
||
| 135 | src: url( "' . get_stylesheet_directory_uri() . '/assets/fonts/noto_sans/NotoSans-BoldItalic.ttf" ) format("truetype"); |
||
| 136 | } |
||
| 137 | |||
| 138 | body{font-family:\'Noto Sans\',sans-serif} |
||
| 139 | h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:\'Lora\',serif} |
||
| 140 | .content-area blockquote:before,.widget-area blockquote:before{font-family:\'Lora\',serif} |
||
| 141 | .wc-social-login:before{font-family:\'Lora\',serif} |
||
| 142 | .blog article.post .entry-title .label-sticky,.blog article.page .entry-title .label-sticky,.blog article.lsx-slot .entry-title .label-sticky,.archive article.post .entry-title .label-sticky,.archive article.page .entry-title .label-sticky,.archive article.lsx-slot .entry-title .label-sticky,.search-results article.post .entry-title .label-sticky,.search-results article.page .entry-title .label-sticky,.search-results article.lsx-slot .entry-title .label-sticky{font-family:\'Noto Sans\',sans-serif} |
||
| 143 | #respond .comment-reply-title>small{font-family:\'Noto Sans\',sans-serif} |
||
| 144 | #comments .media-list .media .media-heading{font-family:\'Noto Sans\',sans-serif} |
||
| 145 | .single-testimonial .entry-content:before{font-family:\'Lora\',serif} |
||
| 146 | '; |
||
| 147 | |||
| 148 | if ( ! empty( $font_styles ) ) { |
||
| 149 | wp_add_inline_style( 'lsx_main', $font_styles ); |
||
| 150 | } |
||
| 151 | } |
||
| 152 | |||
| 206 |