Admidio/admidio

View on GitHub
src/UserInterface/Form.php

Summary

Maintainability
F
2 wks
Test Coverage

File Form.php has 930 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Admidio\UserInterface;

use Admidio\Exception;
use Database;
Severity: Major
Found in src/UserInterface/Form.php - About 2 days to fix

    Function validate has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate(array &$fieldValues): array
        {
            $validFieldValues = array();
    
            if (isset($fieldValues['admidio-csrf-token'])) {
    Severity: Minor
    Found in src/UserInterface/Form.php - About 1 day 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 addSelectBox has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addSelectBox(string $id, string $label, array $values, array $options = array())
        {
            global $gL10n;
    
            $optionsAll = $this->buildOptionsArray(array_replace(array(
    Severity: Minor
    Found in src/UserInterface/Form.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, $gL10n;
    
            $optionsAll = $this->buildOptionsArray(array_replace(array(
    Severity: Major
    Found in src/UserInterface/Form.php - About 5 hrs to fix

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

          public function addSelectBox(string $id, string $label, array $values, array $options = array())
          {
              global $gL10n;
      
              $optionsAll = $this->buildOptionsArray(array_replace(array(
      Severity: Major
      Found in src/UserInterface/Form.php - About 4 hrs to fix

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

            public function addInput(string $id, string $label, string $value, array $options = array())
            {
                global $gSettingsManager, $gLogger, $gL10n;
        
                $optionsAll = $this->buildOptionsArray(array_replace(array(
        Severity: Minor
        Found in src/UserInterface/Form.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 addSelectBoxForCategories has 104 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;
        
                $optionsAll = $this->buildOptionsArray(array_replace(array(
        Severity: Major
        Found in src/UserInterface/Form.php - About 4 hrs to fix

          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;
          
                  $optionsAll = $this->buildOptionsArray(array_replace(array(
          Severity: Minor
          Found in src/UserInterface/Form.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

          Form has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Form
          {
              public const FIELD_DEFAULT  = 0;
              public const FIELD_REQUIRED = 1;
              public const FIELD_DISABLED = 2;
          Severity: Minor
          Found in src/UserInterface/Form.php - About 3 hrs to fix

            Method validate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function validate(array &$fieldValues): array
                {
                    $validFieldValues = array();
            
                    if (isset($fieldValues['admidio-csrf-token'])) {
            Severity: Major
            Found in src/UserInterface/Form.php - About 2 hrs to fix

              Method addEditor has 54 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 src/UserInterface/Form.php - About 2 hrs to fix

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

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

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

                      public function addMultilineTextInput(string $id, string $label, string $value, int $rows, array $options = array())
                      {
                          $optionsAll = $this->buildOptionsArray(array_replace(array(
                              'type'             => 'multiline',
                              'id'               => $id,
                  Severity: Minor
                  Found in src/UserInterface/Form.php - About 1 hr to fix

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

                        public function addFileUpload(string $id, string $label, array $options = array())
                        {
                            $optionsAll = $this->buildOptionsArray(array_replace(array(
                                'type'               => 'file',
                                'id'                 => $id,
                    Severity: Minor
                    Found in src/UserInterface/Form.php - About 1 hr to fix

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

                          public function addSelectBoxFromXml(string $id, string $label, string $xmlFile, string $xmlValueTag, string $xmlViewTag, array $options = array())
                          {
                              $selectBoxEntries = array();
                      
                              try {
                      Severity: Minor
                      Found in src/UserInterface/Form.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 src/UserInterface/Form.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())
                          {
                              $optionsAll = $this->buildOptionsArray(array_replace(array(
                                  'type'             => 'multiline',
                                  'id'               => $id,
                      Severity: Minor
                      Found in src/UserInterface/Form.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 __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __construct(string $id, string $template, string $action = '', HtmlPage $htmlPage = null, array $options = array())
                          {
                              // create array with all options
                              $optionsDefault = array(
                                  'type'               => 'default',
                      Severity: Minor
                      Found in src/UserInterface/Form.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 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 src/UserInterface/Form.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 src/UserInterface/Form.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 src/UserInterface/Form.php - About 35 mins to fix

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

                                public function __construct(string $id, string $template, string $action = '', HtmlPage $htmlPage = null, array $options = array())
                            Severity: Minor
                            Found in src/UserInterface/Form.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 src/UserInterface/Form.php - About 35 mins to fix

                                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 src/UserInterface/Form.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

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

                                    public function addFileUpload(string $id, string $label, array $options = array())
                                    {
                                        $optionsAll = $this->buildOptionsArray(array_replace(array(
                                            'type'               => 'file',
                                            'id'                 => $id,
                                Severity: Minor
                                Found in src/UserInterface/Form.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 src/UserInterface/Form.php and 1 other location - About 7 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 639..673

                                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 src/UserInterface/Form.php and 1 other location - About 7 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1092..1106

                                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 src/UserInterface/Form.php and 1 other location - About 6 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1212..1239

                                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 src/UserInterface/Form.php and 1 other location - About 6 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1462..1481

                                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 src/UserInterface/Form.php and 1 other location - About 5 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1055..1072

                                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 src/UserInterface/Form.php and 1 other location - About 4 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1388..1406

                                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 src/UserInterface/Form.php and 1 other location - About 3 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 702..730

                                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 src/UserInterface/Form.php and 1 other location - About 3 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1074..1090

                                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 src/UserInterface/Form.php and 1 other location - About 3 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1126..1134

                                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 src/UserInterface/Form.php and 1 other location - About 2 hrs to fix
                                adm_program/system/classes/HtmlForm.php on lines 1367..1382

                                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 (isset($this->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 src/UserInterface/Form.php and 1 other location - About 1 hr to fix
                                adm_program/system/classes/HtmlForm.php on lines 1137..1142

                                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 src/UserInterface/Form.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
                                adm_program/system/classes/HtmlForm.php on lines 1032..1050
                                src/UserInterface/Form.php on lines 642..660
                                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 src/UserInterface/Form.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
                                adm_program/system/classes/HtmlForm.php on lines 1032..1050
                                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 src/UserInterface/Form.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
                                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

                                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 (isset($this->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 src/UserInterface/Form.php and 1 other location - About 1 hr to fix
                                adm_program/system/classes/HtmlForm.php on lines 738..756

                                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