.dev/install/install.php

Summary

Maintainability
F
3 days
Test Coverage

File install.php has 580 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

// TODO: form validation
// TODO: add language selector $_POST['install_project_lang']
// TODO: webserver selection (write htaccess or not?)
Severity: Major
Found in .dev/install/install.php - About 1 day to fix

    Method show_html has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function show_html($page = 'form', $vars = [], $errors = [])
        {
            if (php_sapi_name() == 'cli' || ! $_SERVER['PHP_SELF']) {
                return print '__CONSOLE_INSTALL__' . PHP_EOL;
            }
    Severity: Major
    Found in .dev/install/install.php - About 3 hrs to fix

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

          public function show_html($page = 'form', $vars = [], $errors = [])
          {
              if (php_sapi_name() == 'cli' || ! $_SERVER['PHP_SELF']) {
                  return print '__CONSOLE_INSTALL__' . PHP_EOL;
              }
      Severity: Minor
      Found in .dev/install/install.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

      yf_core_install has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class yf_core_install
      {
          /**
           * @param mixed $body
           */
      Severity: Minor
      Found in .dev/install/install.php - About 2 hrs to fix

        Function import_base_db_structure has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function import_base_db_structure()
            {
                $import_tables = [
                    'dashboards',
                    'static_pages',
        Severity: Minor
        Found in .dev/install/install.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 main_layout_html has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function main_layout_html($body = '')
            {
                ob_start(); ?>
        <!DOCTYPE html>
        <html>
        Severity: Major
        Found in .dev/install/install.php - About 2 hrs to fix

          Method import_base_db_structure has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function import_base_db_structure()
              {
                  $import_tables = [
                      'dashboards',
                      'static_pages',
          Severity: Minor
          Found in .dev/install/install.php - About 1 hr to fix

            Method import_demo_data has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function import_demo_data()
                {
                    $lang = $_POST['install_project_lang'];
            
                    $suffix = '.data.php';
            Severity: Minor
            Found in .dev/install/install.php - About 1 hr to fix

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

                  public function write_admin_index_php($rewrite_enabled = true)
                  {
                      $admin_index_file_content = '<?php
              $dev_settings = dirname(dirname(__DIR__)).\'/.dev/override.php\';
              if (file_exists($dev_settings)) {
              Severity: Minor
              Found in .dev/install/install.php - About 1 hr to fix

                Function import_demo_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function import_demo_data()
                    {
                        $lang = $_POST['install_project_lang'];
                
                        $suffix = '.data.php';
                Severity: Minor
                Found in .dev/install/install.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 write_user_index_php has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function write_user_index_php($rewrite_enabled = true)
                    {
                        $index_file_content = '<?php
                $dev_settings = dirname(__DIR__).\'/.dev/override.php\';
                if (file_exists($dev_settings)) {
                Severity: Minor
                Found in .dev/install/install.php - About 1 hr to fix

                  There are no issues that match your filters.

                  Category
                  Status