aristath/kirki

View on GitHub
packages/kirki-framework/module-css/src/CSS/Output.php

Summary

Maintainability
F
3 days
Test Coverage

Function parse_output has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parse_output() {
        foreach ( $this->output as $output ) {
            $skip = false;

            // Apply any sanitization callbacks defined.
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 1 day to fix

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 apply_pattern_replace has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    protected function apply_pattern_replace( $output, $value ) {
        if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) {
            $option_type = ( isset( $this->field['option_type'] ) ) ? $this->field['option_type'] : 'theme_mod';
            $option_name = ( isset( $this->field['option_name'] ) ) ? $this->field['option_name'] : '';
            $options     = [];
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 4 hrs to fix

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 apply_value_pattern has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function apply_value_pattern( $output, $value ) {
        if ( isset( $output['value_pattern'] ) && is_string( $output['value_pattern'] ) ) {
            if ( ! is_array( $value ) ) {
                $value = str_replace( '$', $value, $output['value_pattern'] );
            }
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 3 hrs to fix

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

Method parse_output has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function parse_output() {
        foreach ( $this->output as $output ) {
            $skip = false;

            // Apply any sanitization callbacks defined.
Severity: Major
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 2 hrs to fix

Method apply_pattern_replace has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function apply_pattern_replace( $output, $value ) {
        if ( isset( $output['pattern_replace'] ) && is_array( $output['pattern_replace'] ) ) {
            $option_type = ( isset( $this->field['option_type'] ) ) ? $this->field['option_type'] : 'theme_mod';
            $option_name = ( isset( $this->field['option_name'] ) ) ? $this->field['option_name'] : '';
            $options     = [];
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 1 hr to fix

Function process_output has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function process_output( $output, $value ) {
        $output = apply_filters( 'kirki_output_item_args', $output, $value, $this->output, $this->field );

        if ( ! isset( $output['element'] ) || ! isset( $output['property'] ) ) {
            return;
Severity: Minor
Found in packages/kirki-framework/module-css/src/CSS/Output.php - About 45 mins to fix

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

There are no issues that match your filters.

Category
Status