DerDu/SPHERE-Framework

View on GitHub
Application/Reporting/Dynamic/Service.php

Summary

Maintainability
F
1 wk
Test Coverage

Method createStandardFilter has 331 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createStandardFilter(IFormInterface $Form, TblAccount $tblAccount, $Data = null, $Reset = null)
    {

        if ($Data === null && $Reset === null) {
            return $Form;
Severity: Major
Found in Application/Reporting/Dynamic/Service.php - About 1 day to fix

    File Service.php has 571 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace SPHERE\Application\Reporting\Dynamic;
    
    use SPHERE\Application\Platform\Gatekeeper\Authorization\Account\Account;
    use SPHERE\Application\Platform\Gatekeeper\Authorization\Account\Service\Entity\TblAccount;
    Severity: Major
    Found in Application/Reporting/Dynamic/Service.php - About 1 day to fix

      Function createStandardFilter has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createStandardFilter(IFormInterface $Form, TblAccount $tblAccount, $Data = null, $Reset = null)
          {
      
              if ($Data === null && $Reset === null) {
                  return $Form;
      Severity: Minor
      Found in Application/Reporting/Dynamic/Service.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

      Service has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Service extends AbstractService
      {
      
          /**
           * @param bool $doSimulation
      Severity: Minor
      Found in Application/Reporting/Dynamic/Service.php - About 2 hrs to fix

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

            public function createDynamicFilterOption(IFormInterface $Form, TblDynamicFilter $tblDynamicFilter, $FilterFieldName)
            {
                if (null === $FilterFieldName) {
                    return $Form;
                }
        Severity: Minor
        Found in Application/Reporting/Dynamic/Service.php - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function destroyDynamicFilter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function destroyDynamicFilter(TblDynamicFilter $tblDynamicFilter)
            {
                $FilterMaskList = Dynamic::useService()->getDynamicFilterMaskAllByFilter($tblDynamicFilter);
                if ($FilterMaskList) {
                    foreach ($FilterMaskList as $FilterMask) {
        Severity: Minor
        Found in Application/Reporting/Dynamic/Service.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 createDynamicFilter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createDynamicFilter(IFormInterface $Form, $FilterName, $IsPublic)
            {
        
                if (null === $FilterName) {
                    return $Form;
        Severity: Minor
        Found in Application/Reporting/Dynamic/Service.php - About 1 hr to fix

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

              public function changeDynamicFilter(IFormInterface &$Stage = null, TblDynamicFilter $tblDynamicFilter, $FilterName = null, $IsPublic = false)
              {
          
                  /**
                   * Skip to Frontend
          Severity: Minor
          Found in Application/Reporting/Dynamic/Service.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 createDynamicFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function createDynamicFilter(IFormInterface $Form, $FilterName, $IsPublic)
              {
          
                  if (null === $FilterName) {
                      return $Form;
          Severity: Minor
          Found in Application/Reporting/Dynamic/Service.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

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

                      if ($Name === 'Schüler-Schließfach' && !$this->getDynamicFilterAllByName('Schüler-Schließfach', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Schließfach', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 2 other locations - About 6 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 688..702
          Application/Reporting/Dynamic/Service.php on lines 735..749

          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 216.

          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 3 locations. Consider refactoring.
          Open

                      if ($Name === 'Schüler-Transfer' && !$this->getDynamicFilterAllByName('Schüler-Transfer', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Transfer', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 2 other locations - About 6 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 688..702
          Application/Reporting/Dynamic/Service.php on lines 704..718

          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 216.

          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 3 locations. Consider refactoring.
          Open

                      if ($Name === 'Schüler-Krankenakte' && !$this->getDynamicFilterAllByName('Schüler-Krankenakte', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Krankenakte', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 2 other locations - About 6 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 704..718
          Application/Reporting/Dynamic/Service.php on lines 735..749

          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 216.

          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 3 locations. Consider refactoring.
          Open

                      if ($Name === 'Schüler-Einverständnis' && !$this->getDynamicFilterAllByName('Schüler-Einverständnis', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Einverständnis', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 2 other locations - About 6 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 596..609
          Application/Reporting/Dynamic/Service.php on lines 720..733

          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 204.

          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 3 locations. Consider refactoring.
          Open

                      if ($Name === 'Schüler-Befreiung' && !$this->getDynamicFilterAllByName('Schüler-Befreiung', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Befreiung', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 2 other locations - About 6 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 611..624
          Application/Reporting/Dynamic/Service.php on lines 720..733

          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 204.

          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 3 locations. Consider refactoring.
          Open

                      if ($Name === 'Schüler-Taufe' && !$this->getDynamicFilterAllByName('Schüler-Taufe', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Taufe', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 2 other locations - About 6 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 596..609
          Application/Reporting/Dynamic/Service.php on lines 611..624

          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 204.

          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

                      if ($Name === 'Schüler-Förderbedarf-Teilstörung' && !$this->getDynamicFilterAllByName('Schüler-Förderbedarf-Teilstörung', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Förderbedarf-Teilstörung', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 1 other location - About 5 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 660..672

          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

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

                      if ($Name === 'Schüler-Förderbedarf-Schwerpunkte' && !$this->getDynamicFilterAllByName('Schüler-Förderbedarf-Schwerpunkte', $tblAccount)) {
                          $Filter = $this->addDynamicFilter($tblAccount, 'Schüler-Förderbedarf-Schwerpunkte', false);
                          $Mask = $this->addDynamicFilterMask($Filter, 1, 'SPHERE\Application\People\Group\Service\Entity\ViewPeopleGroupMember');
                          $this->addDynamicFilterOption($Mask, 'TblGroup_Name');
                          $Mask = $this->addDynamicFilterMask($Filter, 2, 'SPHERE\Application\People\Person\Service\Entity\ViewPerson');
          Severity: Major
          Found in Application/Reporting/Dynamic/Service.php and 1 other location - About 5 hrs to fix
          Application/Reporting/Dynamic/Service.php on lines 674..686

          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

          There are no issues that match your filters.

          Category
          Status