phpmyadmin/phpmyadmin

View on GitHub
src/Replication/ReplicationGui.php

Summary

Maintainability
D
3 days
Test Coverage

File ReplicationGui.php has 418 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Functions for the replication GUI
 */

Severity: Minor
Found in src/Replication/ReplicationGui.php - About 6 hrs to fix

    Method getHtmlForReplicaConfiguration has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getHtmlForReplicaConfiguration(
            string|null $connection,
            bool $serverReplicaStatus,
            array $serverReplicaReplication,
            bool $replicaConfigure,
    Severity: Major
    Found in src/Replication/ReplicationGui.php - About 2 hrs to fix

      Method handleControlRequest has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handleControlRequest(
              bool $srTakeAction,
              bool $replicaChangePrimary,
              bool $srReplicaServerControl,
              string|null $srReplicaAction,
      Severity: Major
      Found in src/Replication/ReplicationGui.php - About 2 hrs to fix

        Function handleControlRequest has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handleControlRequest(
                bool $srTakeAction,
                bool $replicaChangePrimary,
                bool $srReplicaServerControl,
                string|null $srReplicaAction,
        Severity: Minor
        Found in src/Replication/ReplicationGui.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 handleRequestForReplicaChangePrimary has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function handleRequestForReplicaChangePrimary(
                string $username,
                string $pmaPassword,
                string $hostname,
                int $port,
        Severity: Minor
        Found in src/Replication/ReplicationGui.php - About 1 hr to fix

          Method getHtmlForReplicationStatusTable has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getHtmlForReplicationStatusTable(
                  string|null $connection,
                  string $type,
                  bool $isHidden = false,
                  bool $hasTitle = true,
          Severity: Minor
          Found in src/Replication/ReplicationGui.php - About 1 hr to fix

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

                public function getHtmlForReplicationPrimaryAddReplicaUser(string|null $postUsername, string|null $hostname): string
                {
                    [$usernameLength, $hostnameLength] = $this->getUsernameHostnameLength();
            
                    $username = '';
            Severity: Minor
            Found in src/Replication/ReplicationGui.php - About 1 hr to fix

              Method handleControlRequest has 11 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      bool $srTakeAction,
                      bool $replicaChangePrimary,
                      bool $srReplicaServerControl,
                      string|null $srReplicaAction,
                      bool $srReplicaSkipError,
              Severity: Major
              Found in src/Replication/ReplicationGui.php - About 1 hr to fix

                Function getHtmlForReplicaConfiguration has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getHtmlForReplicaConfiguration(
                        string|null $connection,
                        bool $serverReplicaStatus,
                        array $serverReplicaReplication,
                        bool $replicaConfigure,
                Severity: Minor
                Found in src/Replication/ReplicationGui.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 getUsernameHostnameLength has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getUsernameHostnameLength(): array
                    {
                        $fieldsInfo = DatabaseInterface::getInstance()->getColumns('mysql', 'user');
                        $usernameLength = 16;
                        $hostnameLength = 41;
                Severity: Minor
                Found in src/Replication/ReplicationGui.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 getHtmlForReplicationStatusTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getHtmlForReplicationStatusTable(
                        string|null $connection,
                        string $type,
                        bool $isHidden = false,
                        bool $hasTitle = true,
                Severity: Minor
                Found in src/Replication/ReplicationGui.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 handleRequestForReplicaChangePrimary has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handleRequestForReplicaChangePrimary(
                        string $username,
                        string $pmaPassword,
                        string $hostname,
                        int $port,
                Severity: Minor
                Found in src/Replication/ReplicationGui.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 getHtmlForPrimaryReplication has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        string|null $connection,
                        bool $hasReplicaClearScreen,
                        string|null $primaryAddUser,
                        string|null $username,
                        string|null $hostname,
                Severity: Minor
                Found in src/Replication/ReplicationGui.php - About 35 mins to fix

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

                      public function getHtmlForReplicationPrimaryAddReplicaUser(string|null $postUsername, string|null $hostname): string
                      {
                          [$usernameLength, $hostnameLength] = $this->getUsernameHostnameLength();
                  
                          $username = '';
                  Severity: Minor
                  Found in src/Replication/ReplicationGui.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