classes/class-author.php

Summary

Maintainability
B
4 hrs
Test Coverage
B
80%

Function get_display_name has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_display_name() {
        if ( 0 === $this->id ) {
            if ( isset( $this->meta['system_user_name'] ) ) {
                return esc_html( $this->meta['system_user_name'] );
            } elseif ( 'wp_cli' === $this->get_current_agent() ) {
Severity: Minor
Found in classes/class-author.php - About 1 hr 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 get_avatar_img has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_avatar_img( $size = 80 ) {
        if ( ! get_option( 'show_avatars' ) ) {
            return false;
        }

Severity: Minor
Found in classes/class-author.php - About 35 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

Avoid too many return statements within this method.
Open

                    return esc_html__( 'N/A', 'stream' );
Severity: Major
Found in classes/class-author.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                        return $this->meta['user_login'];
    Severity: Major
    Found in classes/class-author.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $this->user->display_name;
      Severity: Major
      Found in classes/class-author.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this->user->user_login;
        Severity: Major
        Found in classes/class-author.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status