phpmyadmin/phpmyadmin

View on GitHub
src/Server/Status/Monitor.php

Summary

Maintainability
D
2 days
Test Coverage

File Monitor.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * functions for displaying server status sub item: monitor
 */

Severity: Minor
Found in src/Server/Status/Monitor.php - About 4 hrs to fix

    Method getJsonForLogDataTypeGeneral has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getJsonForLogDataTypeGeneral(
            int $start,
            int $end,
            bool $isTypesLimited,
            bool $removeVariables,
    Severity: Major
    Found in src/Server/Status/Monitor.php - About 2 hrs to fix

      Function getJsonForLogDataTypeGeneral has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getJsonForLogDataTypeGeneral(
              int $start,
              int $end,
              bool $isTypesLimited,
              bool $removeVariables,
      Severity: Minor
      Found in src/Server/Status/Monitor.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

      Method getJsonForLogDataTypeSlow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getJsonForLogDataTypeSlow(int $start, int $end): array|null
          {
              $query = 'SELECT start_time, user_host, ';
              $query .= 'Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, ';
              $query .= 'Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, ';
      Severity: Minor
      Found in src/Server/Status/Monitor.php - About 2 hrs to fix

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

            private function getJsonForChartingDataSwitch(
                string $type,
                string $pName,
                array $serverVars,
                array $statusVars,
        Severity: Minor
        Found in src/Server/Status/Monitor.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 getJsonForChartingDataSwitch has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getJsonForChartingDataSwitch(
                string $type,
                string $pName,
                array $serverVars,
                array $statusVars,
        Severity: Minor
        Found in src/Server/Status/Monitor.php - About 1 hr to fix

          Method getJsonForChartingData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getJsonForChartingData(string $requiredData): array
              {
                  $ret = json_decode($requiredData, true);
                  $statusVars = [];
                  $serverVars = [];
          Severity: Minor
          Found in src/Server/Status/Monitor.php - About 1 hr to fix

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

                public function getJsonForQueryAnalyzer(
                    string $database,
                    string $query,
                ): array {
                    $GLOBALS['cached_affected_rows'] ??= null;
            Severity: Minor
            Found in src/Server/Status/Monitor.php - About 1 hr to fix

              Method getJsonForChartingDataSwitch has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $type,
                      string $pName,
                      array $serverVars,
                      array $statusVars,
                      array $ret,
              Severity: Major
              Found in src/Server/Status/Monitor.php - About 1 hr to fix

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

                    private function getJsonForChartingDataSet(
                        array $ret,
                        array $statusVarValues,
                        array $serverVarValues,
                    ): array {
                Severity: Minor
                Found in src/Server/Status/Monitor.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 getJsonForLogDataTypeSlow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getJsonForLogDataTypeSlow(int $start, int $end): array|null
                    {
                        $query = 'SELECT start_time, user_host, ';
                        $query .= 'Sec_to_Time(Sum(Time_to_Sec(query_time))) as query_time, ';
                        $query .= 'Sec_to_Time(Sum(Time_to_Sec(lock_time))) as lock_time, ';
                Severity: Minor
                Found in src/Server/Status/Monitor.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

                Method getJsonForChartingDataGet has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        array $ret,
                        array $serverVars,
                        array $statusVars,
                        mixed $sysinfo,
                        mixed $cpuload,
                Severity: Minor
                Found in src/Server/Status/Monitor.php - About 45 mins to fix

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

                      public function getJsonForQueryAnalyzer(
                          string $database,
                          string $query,
                      ): array {
                          $GLOBALS['cached_affected_rows'] ??= null;
                  Severity: Minor
                  Found in src/Server/Status/Monitor.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 getJsonForChartingDataGet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getJsonForChartingDataGet(
                          array $ret,
                          array $serverVars,
                          array $statusVars,
                          mixed $sysinfo,
                  Severity: Minor
                  Found in src/Server/Status/Monitor.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