DerDu/SPHERE-Framework

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

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php

namespace SPHERE\Application\Reporting\Custom\Herrnhut\Person;

use MOC\V\Component\Document\Component\Bridge\Repository\PhpExcel;
Severity: Major
Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 2 days to fix

    Method createExtendedClassList has 143 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createExtendedClassList(TblDivision $tblDivision)
        {
    
            $tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision);
    
    
    Severity: Major
    Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 5 hrs to fix

      Function createExtendedClassListExcel has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createExtendedClassListExcel($PersonList, $tblPersonList)
          {
      
              if (!empty( $PersonList )) {
      
      
      Severity: Minor
      Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 5 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 countSubject has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          private function countSubject($tblPersonList, $SubjectType)
          {
      
              $result = array();
              if (empty( $tblPersonList )) {
      Severity: Minor
      Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 5 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 createLanguageListExcel has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createLanguageListExcel($PersonList, $tblPersonList)
          {
      
              if (!empty( $PersonList )) {
      
      
      Severity: Minor
      Found in Application/Reporting/Custom/Herrnhut/Person/Service.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 createLanguageListExcel has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method createExtendedClassListExcel has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method createLanguageList has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function createLanguageList(TblDivision $tblDivision)
              {
          
                  $tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision);
          
          
          Severity: Major
          Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 2 hrs to fix

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

                private function countProfile($tblPersonList)
                {
                    $result = array();
                    if (empty( $tblPersonList )) {
                        return $result;
            Severity: Minor
            Found in Application/Reporting/Custom/Herrnhut/Person/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

            Consider simplifying this complex logical expression.
            Open

                            if (($fromLevel = $tblStudentSubject->getServiceTblLevelFrom())
                                && ($tillLevel = $tblStudentSubject->getServiceTblLevelTill())
                                && $fromLevel->getName()
                                && $tillLevel->getName()
                                && floatval($fromLevel->getName()) <= floatval($level)
            Severity: Critical
            Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 2 hrs to fix

              Method createProfileListExcel has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

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

                    public function createClassList(TblDivision $tblDivision)
                    {
                
                        $tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision);
                
                
                Severity: Major
                Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 2 hrs to fix

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

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

                    Method createProfileList has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function createProfileList(TblDivision $tblDivision)
                        {
                    
                            $tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision);
                    
                    
                    Severity: Minor
                    Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 1 hr to fix

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

                          public function createSignListExcel($PersonList, $tblPersonList)
                          {
                      
                              if (!empty( $PersonList )) {
                      
                      
                      Severity: Minor
                      Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 1 hr to fix

                        Function setForeignLanguage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function setForeignLanguage(TblStudentSubject $tblStudentSubject, TblDivision $tblDivision, &$Item) {
                                $tblSubject = $tblStudentSubject->getServiceTblSubject();
                                if ($tblSubject && ($ranking = $tblStudentSubject->getTblStudentSubjectRanking())) {
                                    if (($tblLevel = $tblDivision->getTblLevel())
                                        && ($level = $tblLevel->getName())
                        Severity: Minor
                        Found in Application/Reporting/Custom/Herrnhut/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

                        Method createSignList has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function createSignList(TblDivision $tblDivision)
                            {
                        
                                $tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision);
                        
                        
                        Severity: Minor
                        Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 1 hr to fix

                          Method setForeignLanguage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function setForeignLanguage(TblStudentSubject $tblStudentSubject, TblDivision $tblDivision, &$Item) {
                                  $tblSubject = $tblStudentSubject->getServiceTblSubject();
                                  if ($tblSubject && ($ranking = $tblStudentSubject->getTblStudentSubjectRanking())) {
                                      if (($tblLevel = $tblDivision->getTblLevel())
                                          && ($level = $tblLevel->getName())
                          Severity: Minor
                          Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 1 hr to fix

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

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

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

                                private function countSubject($tblPersonList, $SubjectType)
                                {
                            
                                    $result = array();
                                    if (empty( $tblPersonList )) {
                            Severity: Minor
                            Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if ($tblStudentTransfer) {
                                                              $Item['Entrance'] = $tblStudentTransfer->getTransferDate();
                                                          }
                              Severity: Major
                              Found in Application/Reporting/Custom/Herrnhut/Person/Service.php - About 45 mins to fix

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

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

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

                                    public function createClassListExcel($PersonList, $tblPersonList)
                                    {
                                
                                        if (!empty( $PersonList )) {
                                
                                
                                Severity: Minor
                                Found in Application/Reporting/Custom/Herrnhut/Person/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 2 locations. Consider refactoring.
                                Open

                                            foreach ($PersonList as $PersonData) {
                                                // Fill Header
                                                if ($Row == 3) {
                                                    $export->setValue($export->getCell(0, 0), 'Klasse: '.$PersonData['Division'].
                                                        ' - Profil Liste');
                                Severity: Major
                                Found in Application/Reporting/Custom/Herrnhut/Person/Service.php and 1 other location - About 1 day to fix
                                Application/Reporting/Custom/Herrnhut/Person/Service.php on lines 255..272

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

                                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 ($PersonList as $PersonData) {
                                                // Fill Header
                                                if ($Row == 3) {
                                                    $export->setValue($export->getCell(0, 0), 'Klasse: '.$PersonData['Division'].
                                                        ' - Unterschriften Liste');
                                Severity: Major
                                Found in Application/Reporting/Custom/Herrnhut/Person/Service.php and 1 other location - About 1 day to fix
                                Application/Reporting/Custom/Herrnhut/Person/Service.php on lines 116..133

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

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

                                                if ($tblToPersonAddress && ($tblAddress = $tblToPersonAddress->getTblAddress())) {
                                                    $Item['StreetName'] = $tblAddress->getStreetName();
                                                    $Item['StreetNumber'] = $tblAddress->getStreetNumber();
                                                    $Item['Code'] = $tblAddress->getTblCity()->getCode();
                                                    $Item['City'] = $tblAddress->getTblCity()->getName();
                                Severity: Major
                                Found in Application/Reporting/Custom/Herrnhut/Person/Service.php and 11 other locations - About 1 hr to fix
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 209..217
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 347..355
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 539..547
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 643..651
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 1002..1010
                                Application/Reporting/Custom/Herrnhut/Person/Service.php on lines 618..626
                                Application/Reporting/Standard/Person/Service.php on lines 523..531
                                Application/Reporting/Standard/Person/Service.php on lines 792..800
                                Application/Reporting/Standard/Person/Service.php on lines 944..952
                                Application/Reporting/Standard/Person/Service.php on lines 1214..1222
                                Application/Reporting/Standard/Person/Service.php on lines 1658..1666

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

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

                                                if ($tblToPersonAddress && ($tblAddress = $tblToPersonAddress->getTblAddress())) {
                                                    $Item['StreetName'] = $tblAddress->getStreetName();
                                                    $Item['StreetNumber'] = $tblAddress->getStreetNumber();
                                                    $Item['Code'] = $tblAddress->getTblCity()->getCode();
                                                    $Item['City'] = $tblAddress->getTblCity()->getName();
                                Severity: Major
                                Found in Application/Reporting/Custom/Herrnhut/Person/Service.php and 11 other locations - About 1 hr to fix
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 209..217
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 347..355
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 539..547
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 643..651
                                Application/Reporting/Custom/Chemnitz/Person/Service.php on lines 1002..1010
                                Application/Reporting/Custom/Herrnhut/Person/Service.php on lines 360..368
                                Application/Reporting/Standard/Person/Service.php on lines 523..531
                                Application/Reporting/Standard/Person/Service.php on lines 792..800
                                Application/Reporting/Standard/Person/Service.php on lines 944..952
                                Application/Reporting/Standard/Person/Service.php on lines 1214..1222
                                Application/Reporting/Standard/Person/Service.php on lines 1658..1666

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

                                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