DerDu/SPHERE-Framework

View on GitHub
Application/People/Meta/Student/Service.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php
namespace SPHERE\Application\People\Meta\Student;

use SPHERE\Application\Corporation\Company\Company;
use SPHERE\Application\Corporation\Company\Service\Entity\TblCompany;
Severity: Major
Found in Application/People/Meta/Student/Service.php - About 1 day to fix

    Function updateStudentGeneral has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateStudentGeneral(TblPerson $tblPerson, $Meta)
        {
    
            // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
            $tblStudent = $tblPerson->getStudent(true);
    Severity: Minor
    Found in Application/People/Meta/Student/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

    Function updateStudentSubject has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        public function updateStudentSubject(TblPerson $tblPerson, $Meta)
        {
    
            // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
            $tblStudent = $tblPerson->getStudent(true);
    Severity: Minor
    Found in Application/People/Meta/Student/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

    Function getCurrentMainDivisionByPerson has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCurrentMainDivisionByPerson(TblPerson $tblPerson)
        {
    
            if (Group::useService()->existsGroupPerson(Group::useService()->getGroupByMetaTable('STUDENT'),
                $tblPerson)
    Severity: Minor
    Found in Application/People/Meta/Student/Service.php - About 7 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

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

    class Service extends Support
    {
    
        /**
         * @return false|ViewStudent[]
    Severity: Minor
    Found in Application/People/Meta/Student/Service.php - About 5 hrs to fix

      Method updateStudentTransfer has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateStudentTransfer(TblPerson $tblPerson, $Meta)
          {
      
              // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
              $tblStudent = $tblPerson->getStudent(true);
      Severity: Major
      Found in Application/People/Meta/Student/Service.php - About 4 hrs to fix

        Method updateStudentGeneral has 115 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function updateStudentGeneral(TblPerson $tblPerson, $Meta)
            {
        
                // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
                $tblStudent = $tblPerson->getStudent(true);
        Severity: Major
        Found in Application/People/Meta/Student/Service.php - About 4 hrs to fix

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

              public function getCurrentDivisionListByPerson(TblPerson $tblPerson)
              {
          
                  $tblDivisionList = array();
                  if (Group::useService()->existsGroupPerson(Group::useService()->getGroupByMetaTable('STUDENT'),
          Severity: Minor
          Found in Application/People/Meta/Student/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

          Function getMainDivisionByPersonAndYear has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getMainDivisionByPersonAndYear(TblPerson $tblPerson, TblYear $tblYear)
              {
          
                  $tblDivisionStudentList = Division::useService()->getDivisionStudentAllByPerson($tblPerson);
                  if ($tblDivisionStudentList) {
          Severity: Minor
          Found in Application/People/Meta/Student/Service.php - About 3 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 updateStudentSubject has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function updateStudentSubject(TblPerson $tblPerson, $Meta)
              {
          
                  // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
                  $tblStudent = $tblPerson->getStudent(true);
          Severity: Major
          Found in Application/People/Meta/Student/Service.php - About 2 hrs to fix

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

                public function updateStudentTransfer(TblPerson $tblPerson, $Meta)
                {
            
                    // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
                    $tblStudent = $tblPerson->getStudent(true);
            Severity: Minor
            Found in Application/People/Meta/Student/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 updateStudentProcess has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateStudentProcess(TblPerson $tblPerson, $Meta)
                {
            
                    // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
                    $tblStudent = $tblPerson->getStudent(true);
            Severity: Minor
            Found in Application/People/Meta/Student/Service.php - About 1 hr to fix

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

                  public function updateStudentMedicalRecord(TblPerson $tblPerson, $Meta)
                  {
              
                      // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
                      $tblStudent = $tblPerson->getStudent(true);
              Severity: Minor
              Found in Application/People/Meta/Student/Service.php - About 1 hr to fix

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

                    public function getDivisionListByPersonAndYear(TblPerson $tblPerson, TblYear $tblYear)
                    {
                
                        $tblDivisionList = array();
                
                
                Severity: Minor
                Found in Application/People/Meta/Student/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 createStudent has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        TblPerson $tblPerson,
                        $Prefix = '',
                        $Identifier = '',
                        TblStudentMedicalRecord $tblStudentMedicalRecord = null,
                        TblStudentTransport $tblStudentTransport = null,
                Severity: Major
                Found in Application/People/Meta/Student/Service.php - About 1 hr to fix

                  Method getCurrentMainDivisionByPerson has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getCurrentMainDivisionByPerson(TblPerson $tblPerson)
                      {
                  
                          if (Group::useService()->existsGroupPerson(Group::useService()->getGroupByMetaTable('STUDENT'),
                              $tblPerson)
                  Severity: Minor
                  Found in Application/People/Meta/Student/Service.php - About 1 hr to fix

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

                        public function updateStudentBasic(TblPerson $tblPerson, $Meta)
                        {
                    
                            $tblStudent = $tblPerson->getStudent(true);
                    
                    
                    Severity: Minor
                    Found in Application/People/Meta/Student/Service.php - About 1 hr to fix

                      Method insertStudentIntegration has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              TblPerson $IntegrationPerson = null,
                              TblCompany $IntegrationCompany = null,
                              $CoachingRequestDate,
                              $CoachingCounselDate,
                              $CoachingDecisionDate,
                      Severity: Major
                      Found in Application/People/Meta/Student/Service.php - About 1 hr to fix

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

                            public function updateStudentMedicalRecord(TblPerson $tblPerson, $Meta)
                            {
                        
                                // Student mit Automatischer Schülernummer anlegen falls noch nicht vorhanden
                                $tblStudent = $tblPerson->getStudent(true);
                        Severity: Minor
                        Found in Application/People/Meta/Student/Service.php - About 55 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (($tblLevel = $tblDivision->getTblLevel())
                                                        && !$tblLevel->getIsChecked()
                                                    ) {
                                                        return $tblDivision;
                                                    }
                        Severity: Major
                        Found in Application/People/Meta/Student/Service.php - About 45 mins to fix

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

                                  TblStudent $tblStudent,
                                  TblStudentSubjectType $tblStudentSubjectType,
                                  TblStudentSubjectRanking $tblStudentSubjectRanking,
                                  TblSubject $tblSubject,
                                  TblLevel $tblLevelFrom = null,
                          Severity: Minor
                          Found in Application/People/Meta/Student/Service.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            if (isset( $Meta['SubjectLevelTill'] ) && isset( $Meta['SubjectLevelTill'][$Category][$Ranking] )) {
                                                                if ($Meta['SubjectLevelTill'][$Category][$Ranking]) {
                                                                    $tblLevelTill = Division::useService()->getLevelById($Meta['SubjectLevelTill'][$Category][$Ranking]);
                                                                }
                                                            }
                            Severity: Major
                            Found in Application/People/Meta/Student/Service.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                              if (isset( $Meta['SubjectLevelFrom'] ) && isset( $Meta['SubjectLevelFrom'][$Category][$Ranking] )) {
                                                                  if ($Meta['SubjectLevelFrom'][$Category][$Ranking]) {
                                                                      $tblLevelFrom = Division::useService()->getLevelById($Meta['SubjectLevelFrom'][$Category][$Ranking]);
                                                                  }
                                                              }
                              Severity: Major
                              Found in Application/People/Meta/Student/Service.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                if ($divisionYear && $divisionYear->getId() == $tblYear->getId()) {
                                                                    $tblDivisionList[] = $tblDivisionStudent->getTblDivision();
                                                                }
                                Severity: Major
                                Found in Application/People/Meta/Student/Service.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                  if ($divisionYear && $divisionYear->getId() == $tblYear->getId()) {
                                                                      if(($tblDivision = $tblDivisionStudent->getTblDivision())){
                                                                          if (($tblLevel = $tblDivision->getTblLevel())
                                                                              && !$tblLevel->getIsChecked()
                                                                          ) {
                                  Severity: Major
                                  Found in Application/People/Meta/Student/Service.php - About 45 mins to fix

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

                                            $Disease,
                                            $Medication,
                                            $Insurance,
                                            $InsuranceState = 0,
                                            $AttendingDoctor = ''
                                    Severity: Minor
                                    Found in Application/People/Meta/Student/Service.php - About 35 mins to fix

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

                                          public function getStudentMaxIdentifier()
                                          {
                                      
                                              $tblStudentList = (new Data($this->getBinding()))->getStudentAll();
                                              $result = 0;
                                      Severity: Minor
                                      Found in Application/People/Meta/Student/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 getCurrentDivisionByPerson has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function getCurrentDivisionByPerson(TblPerson $tblPerson)
                                          {
                                      
                                              $tblDivisionList = $this->getCurrentDivisionListByPerson($tblPerson);
                                              if ($tblDivisionList) {
                                      Severity: Minor
                                      Found in Application/People/Meta/Student/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

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

                                                  if ($tblStudentTransferByTypeArrive) {
                                                      (new Data($this->getBinding()))->updateStudentTransfer(
                                                          $tblStudentTransferByTypeArrive,
                                                          $tblStudent,
                                                          $TransferTypeArrive,
                                      Severity: Major
                                      Found in Application/People/Meta/Student/Service.php and 1 other location - About 6 hrs to fix
                                      Application/People/Meta/Student/Service.php on lines 522..545

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

                                      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 ($tblStudentTransferByTypeLeave) {
                                                      (new Data($this->getBinding()))->updateStudentTransfer(
                                                          $tblStudentTransferByTypeLeave,
                                                          $tblStudent,
                                                          $TransferTypeLeave,
                                      Severity: Major
                                      Found in Application/People/Meta/Student/Service.php and 1 other location - About 6 hrs to fix
                                      Application/People/Meta/Student/Service.php on lines 488..511

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

                                      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

                                          public function addStudentSubject(
                                              TblStudent $tblStudent,
                                              TblStudentSubjectType $tblStudentSubjectType,
                                              TblStudentSubjectRanking $tblStudentSubjectRanking,
                                              TblSubject $tblSubject,
                                      Severity: Minor
                                      Found in Application/People/Meta/Student/Service.php and 2 other locations - About 30 mins to fix
                                      Application/Education/Graduation/Gradebook/Service.php on lines 1149..1160
                                      Application/People/Meta/Student/Service/Service/Subject.php on lines 31..42

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

                                      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