File class-colors.php
has 626 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Super_Awesome_Theme_Colors class
*
* @package Super_Awesome_Theme
Method print_base_color_style_general
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_base_color_style_general() {
$text_color = $this->get( 'text_color' );
$text_focus_color = $this->util()->darken_color( $text_color, 25 );
$text_light_color = $this->util()->lighten_color( $text_color, 100 );
$link_color = $this->get( 'link_color' );
Method print_base_color_style_button
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_base_color_style_button() {
$button_text_color = $this->get( 'button_text_color' );
$button_background_color = $this->get( 'button_background_color' );
$button_background_focus_color = $this->util()->darken_color( $button_background_color, 25 );
$button_primary_text_color = $this->get( 'button_primary_text_color' );
Method print_color_style_css
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_color_style_css() {
/**
* Fires when the custom color styles are printed inside a style tag.
*
Super_Awesome_Theme_Colors
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
final class Super_Awesome_Theme_Colors extends Super_Awesome_Theme_Theme_Component_Base {
/**
* Utility methods instance.
*
Method register_customize_partial
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_customize_partial( $customizer ) {
$partial_colors = array();
if ( ! empty( $this->groups ) ) {
$customizer->add_panel( 'colors', array(
Method print_base_color_style_footer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_base_color_style_footer() {
$footer_text_color = $this->get( 'footer_text_color' );
$footer_link_color = $this->get( 'footer_link_color' );
$footer_link_focus_color = $this->util()->darken_color( $footer_link_color, 25 );
$footer_background_color = $this->get( 'footer_background_color' );
Method print_base_color_style_header
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function print_base_color_style_header() {
$header_text_color = $this->get( 'header_textcolor' );
$header_link_color = $this->get( 'header_link_color' );
$header_link_focus_color = $this->util()->darken_color( $header_link_color, 25 );
$header_background_color = $this->get( 'header_background_color' );
Method register_base_colors_general
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_base_colors_general() {
$this->register_group( 'general_colors', __( 'General Colors', 'super-awesome-theme' ) );
$this->register_color( new Super_Awesome_Theme_Color( 'text_color', array(
Super_Awesome_Theme_Color::PROP_GROUP => 'general_colors',
Method register_customize_controls_js
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function register_customize_controls_js( $assets ) {
$data = array(
'groups' => array(),
'colors' => array(),
'footerWidgetAreas' => super_awesome_theme( 'footer_widget_areas' )->get_widget_area_names(),
Function register_customize_partial
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function register_customize_partial( $customizer ) {
$partial_colors = array();
if ( ! empty( $this->groups ) ) {
$customizer->add_panel( 'colors', array(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function register_customize_controls_js
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function register_customize_controls_js( $assets ) {
$data = array(
'groups' => array(),
'colors' => array(),
'footerWidgetAreas' => super_awesome_theme( 'footer_widget_areas' )->get_widget_area_names(),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( ! empty( $button_primary_text_color ) && ! empty( $button_primary_background_color ) && ! empty( $button_primary_background_focus_color ) ) {
?>
button.button-primary,
input[type="button"].button-primary,
input[type="reset"].button-primary,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 103.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( ! empty( $button_text_color ) && ! empty( $button_background_color ) && ! empty( $button_background_focus_color ) ) {
?>
button,
input[type="button"],
input[type="reset"],
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 103.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 5 locations. Consider refactoring. Open
$assets->register_asset( new Super_Awesome_Theme_Script(
'super-awesome-theme-colors-customize-controls',
get_theme_file_uri( '/assets/dist/js/colors.customize-controls.js' ),
array(
Super_Awesome_Theme_Script::PROP_DEPENDENCIES => array( 'customize-controls', 'wp-i18n' ),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 94.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function register_color( Super_Awesome_Theme_Color $color ) {
$id = $color->get_prop( Super_Awesome_Theme_Color::PROP_ID );
if ( isset( $this->colors[ $id ] ) ) {
return false;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 90.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76