plugins/user/modules/yf_user_profile.class.php

Summary

Maintainability
F
4 days
Test Coverage

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

<?php

// User profile handling module
class yf_user_profile extends yf_module
{
Severity: Major
Found in plugins/user/modules/yf_user_profile.class.php - About 1 day to fix

    Function compact_info has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        public function compact_info()
        {
            main()->NO_GRAPHICS = true;
            conf('no_ajax_here', true);
            // Check user id
    Severity: Minor
    Found in plugins/user/modules/yf_user_profile.class.php - About 5 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 compact_info has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function compact_info()
        {
            main()->NO_GRAPHICS = true;
            conf('no_ajax_here', true);
            // Check user id
    Severity: Major
    Found in plugins/user/modules/yf_user_profile.class.php - About 4 hrs to fix

      Method _show_info_items has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _show_info_items()
          {
              // Array of text fields
              $text_fields = [
                  'name' => 'Name',
      Severity: Major
      Found in plugins/user/modules/yf_user_profile.class.php - About 4 hrs to fix

        Function _show_info_items has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            public function _show_info_items()
            {
                // Array of text fields
                $text_fields = [
                    'name' => 'Name',
        Severity: Minor
        Found in plugins/user/modules/yf_user_profile.class.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

        yf_user_profile has 23 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class yf_user_profile extends yf_module
        {
            /** @var int */
            public $MAX_SHOW_ADS = 10;
            /** @var int */
        Severity: Minor
        Found in plugins/user/modules/yf_user_profile.class.php - About 2 hrs to fix

          Method show has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function show()
              {
                  // Check if user exists
                  if (empty($this->_user_info)) {
                      return _e('No such user!');
          Severity: Major
          Found in plugins/user/modules/yf_user_profile.class.php - About 2 hrs to fix

            Method _init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function _init()
                {
                    if ( ! empty($_SESSION['edit_escort_id'])) {
                        // Do cache
                        if ( ! isset($GLOBALS['_agency_info'])) {
            Severity: Minor
            Found in plugins/user/modules/yf_user_profile.class.php - About 1 hr to fix

              Method show_friend_stats has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function show_friend_stats()
                  {
                      if (empty(main()->USER_ID)) {
                          return _error_need_login();
                      }
              Severity: Minor
              Found in plugins/user/modules/yf_user_profile.class.php - About 1 hr to fix

                Method show_visits_stats has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function show_visits_stats()
                    {
                        if (empty(main()->USER_ID)) {
                            return _error_need_login();
                        }
                Severity: Minor
                Found in plugins/user/modules/yf_user_profile.class.php - About 1 hr to fix

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

                      public function _init()
                      {
                          if ( ! empty($_SESSION['edit_escort_id'])) {
                              // Do cache
                              if ( ! isset($GLOBALS['_agency_info'])) {
                  Severity: Minor
                  Found in plugins/user/modules/yf_user_profile.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 _quick_menu has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _quick_menu()
                      {
                          $menu = [
                              [
                                  'name' => 'Manage',
                  Severity: Minor
                  Found in plugins/user/modules/yf_user_profile.class.php - About 1 hr to fix

                    Function _get_user_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _get_user_info()
                        {
                            if ( ! empty($this->_user_info)) {
                                return '';
                            }
                    Severity: Minor
                    Found in plugins/user/modules/yf_user_profile.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

                    There are no issues that match your filters.

                    Category
                    Status