| Conditions | 1 |
| Paths | 1 |
| Total Lines | 121 |
| 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 |
||
| 30 | function theme_support() { |
||
| 31 | // Add support for editor styles. |
||
| 32 | add_theme_support( 'editor-styles' ); |
||
| 33 | // Add support for full and wide align images. |
||
| 34 | add_theme_support( 'align-wide' ); |
||
| 35 | // Add support for styling blocks. |
||
| 36 | add_theme_support( 'wp-block-styles' ); |
||
| 37 | // Add support for responsive embedded content. |
||
| 38 | add_theme_support( 'responsive-embeds' ); |
||
| 39 | // Add custom editor font sizes. |
||
| 40 | add_theme_support( |
||
| 41 | 'editor-font-sizes', |
||
| 42 | array( |
||
| 43 | array( |
||
| 44 | 'name' => esc_html_x( 'Small', 'font size option label', 'lsx' ), |
||
| 45 | 'shortName' => esc_html_x( 'S', 'abbreviation of the font size option label', 'lsx' ), |
||
| 46 | 'size' => 13, |
||
| 47 | 'slug' => 'small', |
||
| 48 | ), |
||
| 49 | array( |
||
| 50 | 'name' => esc_html_x( 'Normal', 'font size option label', 'lsx' ), |
||
| 51 | 'shortName' => esc_html_x( 'N', 'abbreviation of the font size option label', 'lsx' ), |
||
| 52 | 'size' => 15, |
||
| 53 | 'slug' => 'normal', |
||
| 54 | ), |
||
| 55 | array( |
||
| 56 | 'name' => esc_html_x( 'Medium', 'font size option label', 'lsx' ), |
||
| 57 | 'shortName' => esc_html_x( 'M', 'abbreviation of the font size option label', 'lsx' ), |
||
| 58 | 'size' => 22, |
||
| 59 | 'slug' => 'medium', |
||
| 60 | ), |
||
| 61 | array( |
||
| 62 | 'name' => esc_html_x( 'Large', 'font size option label', 'lsx' ), |
||
| 63 | 'shortName' => esc_html_x( 'L', 'abbreviation of the font size option label', 'lsx' ), |
||
| 64 | 'size' => 30, |
||
| 65 | 'slug' => 'large', |
||
| 66 | ), |
||
| 67 | array( |
||
| 68 | 'name' => esc_html_x( 'Huge', 'font size option label', 'lsx' ), |
||
| 69 | 'shortName' => esc_html_x( 'XL', 'abbreviation of the font size option label', 'lsx' ), |
||
| 70 | 'size' => 40, |
||
| 71 | 'slug' => 'huge', |
||
| 72 | ), |
||
| 73 | ) |
||
| 74 | ); |
||
| 75 | |||
| 76 | // Add support for custom color scheme. |
||
| 77 | add_theme_support( 'editor-color-palette', array( |
||
| 78 | array( |
||
| 79 | 'name' => __( 'Strong Blue', 'lsx' ), |
||
| 80 | 'slug' => 'strong-blue', |
||
| 81 | 'color' => '#27639e', |
||
| 82 | ), |
||
| 83 | array( |
||
| 84 | 'name' => __( 'Lighter Blue', 'lsx' ), |
||
| 85 | 'slug' => 'lighter-blue', |
||
| 86 | 'color' => '#428bca', |
||
| 87 | ), |
||
| 88 | array( |
||
| 89 | 'name' => __( 'Yellow', 'lsx' ), |
||
| 90 | 'slug' => 'light-yellow', |
||
| 91 | 'color' => '#f7ae00', |
||
| 92 | ), |
||
| 93 | array( |
||
| 94 | 'name' => __( 'Dark Yellow', 'lsx' ), |
||
| 95 | 'slug' => 'dark-yellow', |
||
| 96 | 'color' => '#ab7800', |
||
| 97 | ), |
||
| 98 | array( |
||
| 99 | 'name' => __( 'Green', 'lsx' ), |
||
| 100 | 'slug' => 'light-green', |
||
| 101 | 'color' => '#6BA913', |
||
| 102 | ), |
||
| 103 | array( |
||
| 104 | 'name' => __( 'Dark Green', 'lsx' ), |
||
| 105 | 'slug' => 'dark-green', |
||
| 106 | 'color' => '#3F640B', |
||
| 107 | ), |
||
| 108 | array( |
||
| 109 | 'name' => __( 'White', 'lsx' ), |
||
| 110 | 'slug' => 'white', |
||
| 111 | 'color' => '#ffffff', |
||
| 112 | ), |
||
| 113 | array( |
||
| 114 | 'name' => __( 'Black', 'lsx' ), |
||
| 115 | 'slug' => 'black', |
||
| 116 | 'color' => '#000000', |
||
| 117 | ), |
||
| 118 | ) ); |
||
| 119 | |||
| 120 | $primary_color = 'rgba(39,99,158,1)'; |
||
| 121 | $secondary_color = 'rgba(247,174,0,1)'; |
||
| 122 | $tertiary_color = 'rgba(107,169,19,1)'; |
||
| 123 | $background_color = 'rgba(249,249,249,1)'; |
||
| 124 | |||
| 125 | add_theme_support( |
||
| 126 | 'editor-gradient-presets', |
||
| 127 | array( |
||
| 128 | array( |
||
| 129 | 'name' => __( 'Primary to Secondary', 'lsx' ), |
||
| 130 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $secondary_color ) . ' 100%)', |
||
| 131 | 'slug' => 'primary-to-secondary', |
||
| 132 | ), |
||
| 133 | array( |
||
| 134 | 'name' => __( 'Primary to Tertiary', 'lsx' ), |
||
| 135 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
||
| 136 | 'slug' => 'primary-to-tertiary', |
||
| 137 | ), |
||
| 138 | array( |
||
| 139 | 'name' => __( 'Primary to Background', 'lsx' ), |
||
| 140 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $background_color ) . ' 100%)', |
||
| 141 | 'slug' => 'primary-to-background', |
||
| 142 | ), |
||
| 143 | array( |
||
| 144 | 'name' => __( 'Secondary to Tertiary', 'lsx' ), |
||
| 145 | 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $secondary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
||
| 146 | 'slug' => 'secondary-to-tertiary', |
||
| 147 | ), |
||
| 148 | ) |
||
| 149 | ); |
||
| 150 | } |
||
| 151 | endif; |
||
| 165 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.