wikimedia/mediawiki-core

View on GitHub
includes/installer/WebInstaller.php

Summary

Maintainability
F
4 days
Test Coverage

File WebInstaller.php has 678 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Core installer web interface.
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Major
Found in includes/installer/WebInstaller.php - About 1 day to fix

    WebInstaller has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WebInstaller extends Installer {
    
        /**
         * @var WebInstallerOutput
         */
    Severity: Minor
    Found in includes/installer/WebInstaller.php - About 6 hrs to fix

      Function execute has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute( array $session ) {
              $this->session = $session;
      
              if ( isset( $session['settings'] ) ) {
                  $this->settings = $session['settings'] + $this->settings;
      Severity: Minor
      Found in includes/installer/WebInstaller.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 execute has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function execute( array $session ) {
              $this->session = $session;
      
              if ( isset( $session['settings'] ) ) {
                  $this->settings = $session['settings'] + $this->settings;
      Severity: Major
      Found in includes/installer/WebInstaller.php - About 3 hrs to fix

        Method getCheckBox has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getCheckBox( $params ) {
                if ( !isset( $params['controlName'] ) ) {
                    $params['controlName'] = 'config_' . $params['var'];
                }
        
        
        Severity: Minor
        Found in includes/installer/WebInstaller.php - About 1 hr to fix

          Method getPageListItem has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getPageListItem( $pageName, $enabled, $currentPageName ) {
                  $s = "<li class=\"config-page-list-item\">";
          
                  // Messages:
                  // config-page-language, config-page-welcome, config-page-dbconnect, config-page-upgrade,
          Severity: Minor
          Found in includes/installer/WebInstaller.php - About 1 hr to fix

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

                private function getPageListItem( $pageName, $enabled, $currentPageName ) {
                    $s = "<li class=\"config-page-list-item\">";
            
                    // Messages:
                    // config-page-language, config-page-welcome, config-page-dbconnect, config-page-upgrade,
            Severity: Minor
            Found in includes/installer/WebInstaller.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 getRadioElements has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getRadioElements( $params ) {
                    if ( !isset( $params['controlName'] ) ) {
                        $params['controlName'] = 'config_' . $params['var'];
                    }
            
            
            Severity: Minor
            Found in includes/installer/WebInstaller.php - About 1 hr to fix

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

                  public function getTextBox( $params ) {
                      if ( !isset( $params['controlName'] ) ) {
                          $params['controlName'] = 'config_' . $params['var'];
                      }
              
              
              Severity: Minor
              Found in includes/installer/WebInstaller.php - About 1 hr to fix

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

                    public function getTextArea( $params ) {
                        if ( !isset( $params['controlName'] ) ) {
                            $params['controlName'] = 'config_' . $params['var'];
                        }
                
                
                Severity: Minor
                Found in includes/installer/WebInstaller.php - About 1 hr to fix

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

                      public function setVarsFromRequest( $varNames, $prefix = 'config_' ) {
                          $newValues = [];
                  
                          foreach ( $varNames as $name ) {
                              $value = $this->request->getVal( $prefix . $name );
                  Severity: Minor
                  Found in includes/installer/WebInstaller.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 getRadioElements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getRadioElements( $params ) {
                          if ( !isset( $params['controlName'] ) ) {
                              $params['controlName'] = 'config_' . $params['var'];
                          }
                  
                  
                  Severity: Minor
                  Found in includes/installer/WebInstaller.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