awsmug/torro-forms

View on GitHub
src/components/template-tag-handler.php

Summary

Maintainability
A
1 hr
Test Coverage

Function validate_tag_args has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate_tag_args( $tag_args, $tag_args_definition ) {
        if ( count( $tag_args ) !== count( $tag_args_definition ) ) {
            /* translators: %s: template tag handler slug */
            throw new InvalidArgumentException( sprintf( __( 'Invalid template tag arguments passed to handler %s.', 'torro-forms' ), $this->slug ) );
        }
Severity: Minor
Found in src/components/template-tag-handler.php - About 55 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

Function process_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_content( $content, $args ) {
        if ( false === strpos( $content, '{' ) ) {
            return $content;
        }

Severity: Minor
Found in src/components/template-tag-handler.php - About 25 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

Function validate_tag_args_definition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate_tag_args_definition( $tag_args_definition ) {
        foreach ( $tag_args_definition as $type ) {
            switch ( $type ) {
                case 'string':
                case 'int':
Severity: Minor
Found in src/components/template-tag-handler.php - About 25 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