phpmyadmin/phpmyadmin

View on GitHub
src/Types.php

Summary

Maintainability
F
3 days
Test Coverage

File Types.php has 611 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * SQL data types definition
 */

Severity: Major
Found in src/Types.php - About 1 day to fix

    Method getFunctionsClass has 163 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getFunctionsClass(string $class): array
        {
            $isMariaDB = $this->dbi->isMariaDB();
            $serverVersion = $this->dbi->getVersion();
    
    
    Severity: Major
    Found in src/Types.php - About 6 hrs to fix

      Method getTypeDescription has 134 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getTypeDescription(string $type): string
          {
              return match (mb_strtoupper($type)) {
                  'TINYINT' => __('A 1-byte integer, signed range is -128 to 127, unsigned range is 0 to 255'),
                  'SMALLINT' => __('A 2-byte integer, signed range is -32,768 to 32,767, unsigned range is 0 to 65,535'),
      Severity: Major
      Found in src/Types.php - About 5 hrs to fix

        Method getColumns has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getColumns(): array
            {
                $isMariaDB = $this->dbi->isMariaDB();
                $serverVersion = $this->dbi->getVersion();
                $isUUIDSupported = Compatibility::isUUIDSupported($this->dbi);
        Severity: Major
        Found in src/Types.php - About 2 hrs to fix

          Types has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Types
          {
              public function __construct(private DatabaseInterface $dbi)
              {
              }
          Severity: Minor
          Found in src/Types.php - About 2 hrs to fix

            Method getTypeClass has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getTypeClass(string $type): string
                {
                    return match (mb_strtoupper($type)) {
                        'TINYINT',
                        'SMALLINT',
            Severity: Minor
            Found in src/Types.php - About 1 hr to fix

              Function getFunctionsClass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getFunctionsClass(string $class): array
                  {
                      $isMariaDB = $this->dbi->isMariaDB();
                      $serverVersion = $this->dbi->getVersion();
              
              
              Severity: Minor
              Found in src/Types.php - About 45 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 getColumns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getColumns(): array
                  {
                      $isMariaDB = $this->dbi->isMariaDB();
                      $serverVersion = $this->dbi->getVersion();
                      $isUUIDSupported = Compatibility::isUUIDSupported($this->dbi);
              Severity: Minor
              Found in src/Types.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 [
                                  'GeomFromText',
                                  'GeomFromWKB',
              
                                  'GeomCollFromText',
              Severity: Major
              Found in src/Types.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return [];
                Severity: Major
                Found in src/Types.php - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status