classes/yf_graphics.class.php

Summary

Maintainability
F
5 days
Test Coverage

File yf_graphics.class.php has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Core content-related methods stored here.
 *
Severity: Minor
Found in classes/yf_graphics.class.php - About 7 hrs to fix

    Function show_metatags has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        public function show_metatags($meta = [])
        {
            if (empty($meta)) {
                $meta = $this->META_DEFAULT;
            }
    Severity: Minor
    Found in classes/yf_graphics.class.php - About 7 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 tip has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function tip($in = null, $extra = [])
        {
            if ( ! is_array($extra)) {
                $extra = [];
            }
    Severity: Minor
    Found in classes/yf_graphics.class.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

    yf_graphics has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_graphics
    {
        /** @var bool Add pages names to the title */
        public $ADD_TITLE_PAGES = true;
        /** @var bool Show auto-parsed (and tried to translate) task name */
    Severity: Minor
    Found in classes/yf_graphics.class.php - About 4 hrs to fix

      Method show_metatags has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function show_metatags($meta = [])
          {
              if (empty($meta)) {
                  $meta = $this->META_DEFAULT;
              }
      Severity: Major
      Found in classes/yf_graphics.class.php - About 3 hrs to fix

        Method tip has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function tip($in = null, $extra = [])
            {
                if ( ! is_array($extra)) {
                    $extra = [];
                }
        Severity: Major
        Found in classes/yf_graphics.class.php - About 2 hrs to fix

          Function show_site_title has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function show_site_title()
              {
                  if (defined('SITE_ADVERT_NAME')) {
                      $title = SITE_ADVERT_NAME;
                  }
          Severity: Minor
          Found in classes/yf_graphics.class.php - About 2 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 quick_menu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              public function quick_menu()
              {
                  if ( ! $this->QUICK_MENU_ENABLED
                      || (MAIN_TYPE_USER && ( ! isset($_SESSION['user_id']) || ! $_SESSION['user_id']))
                      || (MAIN_TYPE_ADMIN && ( ! isset($_SESSION['admin_id']) || ! $_SESSION['admin_id']))
          Severity: Minor
          Found in classes/yf_graphics.class.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

          Method show_site_title has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function show_site_title()
              {
                  if (defined('SITE_ADVERT_NAME')) {
                      $title = SITE_ADVERT_NAME;
                  }
          Severity: Minor
          Found in classes/yf_graphics.class.php - About 1 hr to fix

            Method quick_menu has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function quick_menu()
                {
                    if ( ! $this->QUICK_MENU_ENABLED
                        || (MAIN_TYPE_USER && ( ! isset($_SESSION['user_id']) || ! $_SESSION['user_id']))
                        || (MAIN_TYPE_ADMIN && ( ! isset($_SESSION['admin_id']) || ! $_SESSION['admin_id']))
            Severity: Minor
            Found in classes/yf_graphics.class.php - About 1 hr to fix

              Function _send_main_headers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function _send_main_headers($content_length = 0)
                  {
                      if (headers_sent($file, $line) || conf('no_headers')) {
                          //            trigger_error('Headers were sent in '.$file.':'.$line, E_USER_WARNING);
                          return false;
              Severity: Minor
              Found in classes/yf_graphics.class.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

              Method show_welcome has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function show_welcome()
                  {
                      // For authorized admins only
                      if (MAIN_TYPE_ADMIN) {
                          $login_time = $_SESSION['admin_login_time'];
              Severity: Minor
              Found in classes/yf_graphics.class.php - About 1 hr to fix

                Function show_welcome has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function show_welcome()
                    {
                        // For authorized admins only
                        if (MAIN_TYPE_ADMIN) {
                            $login_time = $_SESSION['admin_login_time'];
                Severity: Minor
                Found in classes/yf_graphics.class.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

                Method _show_header has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function _show_header()
                    {
                        if (conf('no_page_header')) {
                            return false;
                        }
                Severity: Minor
                Found in classes/yf_graphics.class.php - About 1 hr to fix

                  Method _send_main_headers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _send_main_headers($content_length = 0)
                      {
                          if (headers_sent($file, $line) || conf('no_headers')) {
                              //            trigger_error('Headers were sent in '.$file.':'.$line, E_USER_WARNING);
                              return false;
                  Severity: Minor
                  Found in classes/yf_graphics.class.php - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ( ! $this->QUICK_MENU_ENABLED
                                || (MAIN_TYPE_USER && ( ! isset($_SESSION['user_id']) || ! $_SESSION['user_id']))
                                || (MAIN_TYPE_ADMIN && ( ! isset($_SESSION['admin_id']) || ! $_SESSION['admin_id']))
                            ) {
                                return false;
                    Severity: Major
                    Found in classes/yf_graphics.class.php - About 1 hr to fix

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

                          public function _show_header()
                          {
                              if (conf('no_page_header')) {
                                  return false;
                              }
                      Severity: Minor
                      Found in classes/yf_graphics.class.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 _send_custom_http_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function _send_custom_http_headers()
                          {
                              // Override headers
                              $conf_headers = conf('http_headers');
                              if (is_array($conf_headers)) {
                      Severity: Minor
                      Found in classes/yf_graphics.class.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 html()->tooltip($extra['text'], $extra);
                      Severity: Major
                      Found in classes/yf_graphics.class.php - About 30 mins to fix

                        There are no issues that match your filters.

                        Category
                        Status