modxcms/revolution

View on GitHub
setup/includes/request/modinstallclirequest.class.php

Summary

Maintainability
C
1 day
Test Coverage

Function checkDatabase has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkDatabase() {
        $mode = $this->install->settings->get('installmode');
        if ($mode == modInstall::MODE_NEW) {
            $results = $this->install->driver->verifyServerVersion();
            if ($results['result'] == 'failure') {
Severity: Minor
Found in setup/includes/request/modinstallclirequest.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

Method handle has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle($action = '') {
        $this->beginTimer();
        /* prepare the settings */
        $settings = $_REQUEST;
        if (empty($settings['installmode'])) $settings['installmode'] = modInstall::MODE_NEW;
Severity: Major
Found in setup/includes/request/modinstallclirequest.class.php - About 2 hrs to fix

    Function handle has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle($action = '') {
            $this->beginTimer();
            /* prepare the settings */
            $settings = $_REQUEST;
            if (empty($settings['installmode'])) $settings['installmode'] = modInstall::MODE_NEW;
    Severity: Minor
    Found in setup/includes/request/modinstallclirequest.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

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

        public function checkDatabase() {
            $mode = $this->install->settings->get('installmode');
            if ($mode == modInstall::MODE_NEW) {
                $results = $this->install->driver->verifyServerVersion();
                if ($results['result'] == 'failure') {
    Severity: Major
    Found in setup/includes/request/modinstallclirequest.class.php - About 2 hrs to fix

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

          public function loadConfigFile() {
              $settings = array();
              $configFile = $this->install->settings->get('config');
              if (empty($configFile)) $configFile = MODX_INSTALL_PATH.'setup/config.xml';
              if (!empty($configFile)) {
      Severity: Minor
      Found in setup/includes/request/modinstallclirequest.class.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 getInstallMode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getInstallMode($mode) {
              if (!is_int($mode)) {
                  switch ($mode) {
                      case 'new':
                          $mode = modInstall::MODE_NEW;
      Severity: Minor
      Found in setup/includes/request/modinstallclirequest.class.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