DerDu/SPHERE-Framework

View on GitHub
Application/Reporting/Custom/BadDueben/Person/Service.php

Summary

Maintainability
F
1 wk
Test Coverage

Method createClassList has 231 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createClassList($tblDivisionList)
    {

        $tblPersonList = false;
        $tblYear = false;
Severity: Major
Found in Application/Reporting/Custom/BadDueben/Person/Service.php - About 1 day to fix

    Function createClassList has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createClassList($tblDivisionList)
        {
    
            $tblPersonList = false;
            $tblYear = false;
    Severity: Minor
    Found in Application/Reporting/Custom/BadDueben/Person/Service.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

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

    <?php
    /**
     * Created by PhpStorm.
     * User: Kauschke
     * Date: 18.12.2018
    Severity: Minor
    Found in Application/Reporting/Custom/BadDueben/Person/Service.php - About 4 hrs to fix

      Method createClassListExcel has 101 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createClassListExcel($PersonList, $tblPersonList)
          {
      
              if (!empty($PersonList)) {
      
      
      Severity: Major
      Found in Application/Reporting/Custom/BadDueben/Person/Service.php - About 4 hrs to fix

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

            public function createClassListExcel($PersonList, $tblPersonList)
            {
        
                if (!empty($PersonList)) {
        
        
        Severity: Minor
        Found in Application/Reporting/Custom/BadDueben/Person/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

        Avoid deeply nested control flow statements.
        Open

                                    switch ($Item['Gender']) {
                                        case "Männlich":
                                            $Item['GenderExcel'] = "m";
                                            break;
                                        case "Weiblich":
        Severity: Major
        Found in Application/Reporting/Custom/BadDueben/Person/Service.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                          if ($tblYearDivision->getId() == $tblYear->getId()) {
                                              $DivisionArray[] = $tblDivision->getDisplayName();
                                          }
          Severity: Major
          Found in Application/Reporting/Custom/BadDueben/Person/Service.php - About 45 mins to fix

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

                            if (!empty($GuardianList)) {
                                /** @var TblPerson $Guardian */
                                foreach ($GuardianList as $Key => $Guardian) {
                                    // Guardian phone
                                    $phoneList = Phone::useService()->getPhoneAllByPerson($Guardian);
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 1 day to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 233..276

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

            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 ($tblPersonList) {
                        foreach ($tblPersonList as $tblPerson) {
                            $tblGroupList = Group::useService()->getGroupAllByPerson($tblPerson);
                            if ($tblGroupList) {
                                $isGroup = false;
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 5 hrs to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 49..72

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

            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 ($address !== null) {
                                $Item['StreetName'] = $address->getTblAddress()->getStreetName();
                                $Item['StreetNumber'] = $address->getTblAddress()->getStreetNumber();
                                $Item['ExcelStreet'] = $address->getTblAddress()->getStreetName().' '.$address->getTblAddress()->getStreetNumber();
                                $Item['Code'] = $address->getTblAddress()->getTblCity()->getCode();
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 2 hrs to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 196..203

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

            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 (!empty($SortGroupList)) {
                        ksort($SortGroupList);
                        foreach ($SortGroupList as $Key => $tblPersonArray) {
                            // sort by LastName and FirstName
                            $LastName = array();
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 2 hrs to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 75..93

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

            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 ($tblYear
                                && ($tblMainDivision = Student::useService()->getMainDivisionByPersonAndYear($tblPerson, $tblYear))
                                && ($tblMainLevel = $tblMainDivision->getTblLevel())
                                && ($tblMainType = $tblMainLevel->getServiceTblType())
                            ) {
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 2 hrs to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 152..171

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

            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 ($tblGroupList) {
                                $MentorGroupList = array();
                                foreach ($tblGroupList as $tblGroup) {
                                    if ($isMentor && preg_match('!(Mentorengruppe\s)([\w]*)!', $tblGroup->getName(), $Match)) {
                                        $MentorGroupList[] = $Match[2];
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 2 hrs to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 120..132

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

            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 ($phoneList) {
                                foreach ($phoneList as $phone) {
                                    if ($phone->getTblType()->getName() == 'Privat' && $phone->getTblType()->getDescription() == 'Festnetz') {
                                        $phoneNumbersPrivate[] = $phone->getTblPhone()->getNumber();
                                    }
            Severity: Major
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 1 hr to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 208..218

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

            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 ($tblDivisionStudentList && $tblYear) {
                                $DivisionArray = array();
                                foreach ($tblDivisionStudentList as $tblDivisionStudent) {
                                    if (( $tblDivision = $tblDivisionStudent->getTblDivision() )) {
                                        if (( $tblYearDivision = $tblDivision->getServiceTblYear() )) {
            Severity: Minor
            Found in Application/Reporting/Custom/BadDueben/Person/Service.php and 1 other location - About 45 mins to fix
            Application/Reporting/Custom/Muldental/Person/Service.php on lines 138..150

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

            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