Admidio/admidio

View on GitHub
adm_program/system/classes/HtmlForm.php

Summary

Maintainability
F
2 wks
Test Coverage

File HtmlForm.php has 898 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
use Admidio\Exception;

/**
 * @brief Creates an Admidio specific form with special elements
Severity: Major
Found in adm_program/system/classes/HtmlForm.php - About 2 days to fix

    Function addSelectBox has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addSelectBox(string $id, string $label, array $values, array $options = array())
        {
            global $gL10n;
    
            ++$this->countElements;
    Severity: Minor
    Found in adm_program/system/classes/HtmlForm.php - About 6 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 addInput has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function addInput(string $id, string $label, string $value, array $options = array())
        {
            global $gSettingsManager, $gLogger;
    
            ++$this->countElements;
    Severity: Major
    Found in adm_program/system/classes/HtmlForm.php - About 5 hrs to fix

      Method addSelectBox has 120 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addSelectBox(string $id, string $label, array $values, array $options = array())
          {
              global $gL10n;
      
              ++$this->countElements;
      Severity: Major
      Found in adm_program/system/classes/HtmlForm.php - About 4 hrs to fix

        Method addSelectBoxForCategories has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addSelectBoxForCategories(string $id, string $label, Database $database, string $categoryType, string $selectBoxModus, array $options = array())
            {
                global $gCurrentOrganization, $gCurrentUser, $gL10n;
        
                // create array with all options
        Severity: Major
        Found in adm_program/system/classes/HtmlForm.php - About 4 hrs to fix

          Function addInput has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addInput(string $id, string $label, string $value, array $options = array())
              {
                  global $gSettingsManager, $gLogger;
          
                  ++$this->countElements;
          Severity: Minor
          Found in adm_program/system/classes/HtmlForm.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

          Function addSelectBoxForCategories has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function addSelectBoxForCategories(string $id, string $label, Database $database, string $categoryType, string $selectBoxModus, array $options = array())
              {
                  global $gCurrentOrganization, $gCurrentUser, $gL10n;
          
                  // create array with all options
          Severity: Minor
          Found in adm_program/system/classes/HtmlForm.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

          HtmlForm has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class HtmlForm
          {
              public const FIELD_DEFAULT  = 0;
              public const FIELD_REQUIRED = 1;
              public const FIELD_DISABLED = 2;
          Severity: Minor
          Found in adm_program/system/classes/HtmlForm.php - About 3 hrs to fix

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

                public function addEditor(string $id, string $label, string $value, array $options = array())
                {
                    global $gSettingsManager, $gL10n;
            
                    $flagLabelVertical = $this->type;
            Severity: Major
            Found in adm_program/system/classes/HtmlForm.php - About 2 hrs to fix

              Method addMultilineTextInput has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function addMultilineTextInput(string $id, string $label, string $value, int $rows, array $options = array())
                  {
                      ++$this->countElements;
              
                      // create array with all options
              Severity: Minor
              Found in adm_program/system/classes/HtmlForm.php - About 2 hrs to fix

                Method addFileUpload has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addFileUpload(string $id, string $label, array $options = array())
                    {
                        ++$this->countElements;
                
                        // create array with all options
                Severity: Minor
                Found in adm_program/system/classes/HtmlForm.php - About 1 hr to fix

                  Method __construct has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct(string $id, string $action = '', HtmlPage $htmlPage = null, array $options = array())
                      {
                          // create array with all options
                          $optionsDefault = array(
                              'type'               => 'default',
                  Severity: Minor
                  Found in adm_program/system/classes/HtmlForm.php - About 1 hr to fix

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

                        public function __construct(string $id, string $action = '', HtmlPage $htmlPage = null, array $options = array())
                        {
                            // create array with all options
                            $optionsDefault = array(
                                'type'               => 'default',
                    Severity: Minor
                    Found in adm_program/system/classes/HtmlForm.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 addEditor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function addEditor(string $id, string $label, string $value, array $options = array())
                        {
                            global $gSettingsManager, $gL10n;
                    
                            $flagLabelVertical = $this->type;
                    Severity: Minor
                    Found in adm_program/system/classes/HtmlForm.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 addMultilineTextInput has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function addMultilineTextInput(string $id, string $label, string $value, int $rows, array $options = array())
                        {
                            ++$this->countElements;
                    
                            // create array with all options
                    Severity: Minor
                    Found in adm_program/system/classes/HtmlForm.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 addCheckbox has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function addCheckbox(string $id, string $label, bool $checked = false, array $options = array())
                        {
                            ++$this->countElements;
                    
                            // create array with all options
                    Severity: Minor
                    Found in adm_program/system/classes/HtmlForm.php - About 1 hr to fix

                      Method addRadioButton has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function addRadioButton(string $id, string $label, array $values, array $options = array())
                          {
                              ++$this->countElements;
                      
                              // create array with all options
                      Severity: Minor
                      Found in adm_program/system/classes/HtmlForm.php - About 1 hr to fix

                        Method addButton has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function addButton(string $id, string $text, array $options = array())
                            {
                                ++$this->countElements;
                                // create array with all options
                                $optionsDefault = array(
                        Severity: Minor
                        Found in adm_program/system/classes/HtmlForm.php - About 1 hr to fix

                          Function addSelectBoxFromXml has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function addSelectBoxFromXml(string $id, string $label, string $xmlFile, string $xmlValueTag, string $xmlViewTag, array $options = array())
                              {
                                  $selectBoxEntries = array();
                          
                                  $xmlRootNode = new SimpleXMLElement($xmlFile, 0, true);
                          Severity: Minor
                          Found in adm_program/system/classes/HtmlForm.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 addSelectBoxForCategories has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function addSelectBoxForCategories(string $id, string $label, Database $database, string $categoryType, string $selectBoxModus, array $options = array())
                          Severity: Minor
                          Found in adm_program/system/classes/HtmlForm.php - About 45 mins to fix

                            Method addSelectBoxFromXml has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function addSelectBoxFromXml(string $id, string $label, string $xmlFile, string $xmlValueTag, string $xmlViewTag, array $options = array())
                            Severity: Minor
                            Found in adm_program/system/classes/HtmlForm.php - About 45 mins to fix

                              Method addMultilineTextInput has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function addMultilineTextInput(string $id, string $label, string $value, int $rows, array $options = array())
                              Severity: Minor
                              Found in adm_program/system/classes/HtmlForm.php - About 35 mins to fix

                                Method addSelectBoxFromSql has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function addSelectBoxFromSql(string $id, string $label, Database $database, $sql, array $options = array())
                                Severity: Minor
                                Found in adm_program/system/classes/HtmlForm.php - About 35 mins to fix

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

                                      public static function getHelpText($text)
                                      {
                                          $parameters = array();
                                  
                                          if (is_array($text)) {
                                  Severity: Minor
                                  Found in adm_program/system/classes/HtmlForm.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

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

                                      public function addFileUpload(string $id, string $label, array $options = array())
                                      {
                                          ++$this->countElements;
                                  
                                          // create array with all options
                                  Severity: Minor
                                  Found in adm_program/system/classes/HtmlForm.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

                                  Function addSelectBoxFromSql has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function addSelectBoxFromSql(string $id, string $label, Database $database, $sql, array $options = array())
                                      {
                                          $selectBoxEntries = array();
                                  
                                          // execute the sql statement
                                  Severity: Minor
                                  Found in adm_program/system/classes/HtmlForm.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

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          switch ($optionsAll['type']) {
                                              case 'text': // fallthrough
                                              case 'search': // fallthrough
                                              case 'email': // fallthrough
                                              case 'url': // fallthrough
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 7 hrs to fix
                                  src/UserInterface/Form.php on lines 605..639

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 237.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if ($optionsAll['firstEntry'] !== '') {
                                              if (is_array($optionsAll['firstEntry'])) {
                                                  array_unshift($valuesArray, array('id' => $optionsAll['firstEntry'][0], 'value' => $optionsAll['firstEntry'][1]));
                                              } else {
                                                  array_unshift($valuesArray, array('id' => '', 'value' => '- ' . $optionsAll['firstEntry'] . ' -'));
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 7 hrs to fix
                                  src/UserInterface/Form.php on lines 1038..1052

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 232.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      public function addSelectBoxFromSql(string $id, string $label, Database $database, $sql, array $options = array())
                                      {
                                          $selectBoxEntries = array();
                                  
                                          // execute the sql statement
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 6 hrs to fix
                                  src/UserInterface/Form.php on lines 1161..1188

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 221.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          while ($row = $pdoStatement->fetch()) {
                                              // if several categories exist than select default category
                                              if ($selectBoxModus === self::SELECT_BOX_MODUS_EDIT && $optionsAll['defaultValue'] === ''
                                                  && ($countCategories === 1 || $row['cat_default'] === 1)) {
                                                  $optionsAll['defaultValue'] = $row['cat_uuid'];
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 6 hrs to fix
                                  src/UserInterface/Form.php on lines 1410..1429

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 214.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          foreach($values as $arrayKey => $arrayValue) {
                                              if (is_array($arrayValue)) {
                                                  if (array_key_exists(2, $arrayValue)) {
                                                      $valuesArray[] = array(
                                                          'id' => ($optionsAll['arrayKeyIsNotValue'] ? $arrayValue[1] : $arrayValue[0]),
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 5 hrs to fix
                                  src/UserInterface/Form.php on lines 999..1018

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 192.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if ($selectBoxModus === self::SELECT_BOX_MODUS_FILTER) {
                                              $catIdParams = array_merge(array(0), $gCurrentUser->getAllVisibleCategories($categoryType));
                                              $optionsAll['showContextDependentFirstEntry'] = false;
                                  
                                              switch ($categoryType) {
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 4 hrs to fix
                                  src/UserInterface/Form.php on lines 1336..1354

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 170.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if ($optionsAll['type'] === 'datetime') {
                                              $datetime = DateTime::createFromFormat($gSettingsManager->getString('system_date') . ' ' . $gSettingsManager->getString('system_time'), $value);
                                  
                                              // now add a date and a time field to the form
                                              $attributes['dateValue'] = null;
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 3 hrs to fix
                                  src/UserInterface/Form.php on lines 668..703

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 159.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if ($optionsAll['multiselect']) {
                                              $attributes['multiple'] = 'multiple';
                                              $attributes['name'] = $id . '[]';
                                  
                                              if ($optionsAll['defaultValue'] !== '' && !is_array($optionsAll['defaultValue'])) {
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 3 hrs to fix
                                  src/UserInterface/Form.php on lines 1020..1036

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 152.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                              if (is_array($optionsAll['defaultValue']) && count($optionsAll['defaultValue']) > 0) {
                                                  // add default values to multi select
                                                  $htmlDefaultValues = '"' . implode('", "', $optionsAll['defaultValue']) . '"';
                                  
                                                  $javascriptCode .= ' $("#' . $id . '").val([' . $htmlDefaultValues . ']).trigger("change.select2");';
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 3 hrs to fix
                                  src/UserInterface/Form.php on lines 1072..1080

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 148.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                          if ($selectBoxModus === self::SELECT_BOX_MODUS_EDIT && $gCurrentOrganization->countAllRecords() > 1) {
                                              $optionsAll['alertWarning'] = $gL10n->get('SYS_ALL_ORGANIZATIONS_DESC', array(implode(', ', $gCurrentOrganization->getOrganizationsInRelationship(true, true, true))));
                                  
                                              $this->addJavascriptCode(
                                                  '
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 2 hrs to fix
                                  src/UserInterface/Form.php on lines 1315..1330

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 125.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                              if ($this->htmlPage instanceof HtmlPage) {
                                                  $this->htmlPage->addCssFile(ADMIDIO_URL . FOLDER_LIBS . '/select2/css/select2.css');
                                                  $this->htmlPage->addCssFile(ADMIDIO_URL . FOLDER_LIBS . '/select2-bootstrap-theme/select2-bootstrap-5-theme.css');
                                                  $this->htmlPage->addJavascriptFile(ADMIDIO_URL . FOLDER_LIBS . '/select2/js/select2.js');
                                                  $this->htmlPage->addJavascriptFile(ADMIDIO_URL . FOLDER_LIBS . '/select2/js/i18n/' . $gL10n->getLanguageLibs() . '.js');
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 1 hr to fix
                                  src/UserInterface/Form.php on lines 1083..1088

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 112.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 6 locations. Consider refactoring.
                                  Open

                                          switch ($optionsAll['property']) {
                                              case self::FIELD_DISABLED:
                                                  $attributes['disabled'] = 'disabled';
                                                  break;
                                  
                                  
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 5 other locations - About 1 hr to fix
                                  adm_program/system/classes/HtmlForm.php on lines 676..694
                                  adm_program/system/classes/HtmlForm.php on lines 1032..1050
                                  src/UserInterface/Form.php on lines 642..660
                                  src/UserInterface/Form.php on lines 800..818
                                  src/UserInterface/Form.php on lines 976..994

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 107.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 6 locations. Consider refactoring.
                                  Open

                                          switch ($optionsAll['property']) {
                                              case self::FIELD_DISABLED:
                                                  $attributes['disabled'] = 'disabled';
                                                  break;
                                  
                                  
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 5 other locations - About 1 hr to fix
                                  adm_program/system/classes/HtmlForm.php on lines 840..858
                                  adm_program/system/classes/HtmlForm.php on lines 1032..1050
                                  src/UserInterface/Form.php on lines 642..660
                                  src/UserInterface/Form.php on lines 800..818
                                  src/UserInterface/Form.php on lines 976..994

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 107.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 6 locations. Consider refactoring.
                                  Open

                                          switch ($optionsAll['property']) {
                                              case self::FIELD_DISABLED:
                                                  $attributes['disabled'] = 'disabled';
                                                  break;
                                  
                                  
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 5 other locations - About 1 hr to fix
                                  adm_program/system/classes/HtmlForm.php on lines 676..694
                                  adm_program/system/classes/HtmlForm.php on lines 840..858
                                  src/UserInterface/Form.php on lines 642..660
                                  src/UserInterface/Form.php on lines 800..818
                                  src/UserInterface/Form.php on lines 976..994

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 107.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                              if ($this->htmlPage instanceof HtmlPage) {
                                                  $zxcvbnUserInputs = json_encode($optionsAll['passwordUserData'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
                                                  $javascriptCode = '
                                                      $("#admidio-password-strength-minimum").css("margin-left", "calc(" + $("#admidio-password-strength").css("width") + " / 4 * '.$passwordStrengthLevel.')");
                                  
                                  
                                  Severity: Major
                                  Found in adm_program/system/classes/HtmlForm.php and 1 other location - About 1 hr to fix
                                  src/UserInterface/Form.php on lines 711..729

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 105.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  There are no issues that match your filters.

                                  Category
                                  Status