DerDu/SPHERE-Framework

View on GitHub
Application/Education/Lesson/Division/Service.php

Summary

Maintainability
F
3 wks
Test Coverage

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

<?php
namespace SPHERE\Application\Education\Lesson\Division;

use SPHERE\Application\Education\Graduation\Evaluation\Evaluation;
use SPHERE\Application\Education\Graduation\Gradebook\Gradebook;
Severity: Major
Found in Application/Education/Lesson/Division/Service.php - About 4 days to fix

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

    class Service extends AbstractService
    {
    
        /**
         * @return false|ViewDivision[]
    Severity: Major
    Found in Application/Education/Lesson/Division/Service.php - About 2 days to fix

      Function addSubjectWithGroups has a Cognitive Complexity of 110 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addSubjectWithGroups(
              TblDivision $tblDivision,
              TblDivision $tblDivisionCopy
          ) {
      
      
      Severity: Minor
      Found in Application/Education/Lesson/Division/Service.php - About 2 days 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 copyDivision has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
      Open

          public
          function copyDivision(
              IFormInterface $Form,
              TblDivision $tblDivision,
              $Level,
      Severity: Minor
      Found in Application/Education/Lesson/Division/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 getMinDivisionByLevelType has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
      Open

          public
          function getMinDivisionByLevelType(
              TblType $tblType
          ) {
      
      
      Severity: Minor
      Found in Application/Education/Lesson/Division/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

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

          public
          function getDivisionSubjectAllByPersonAndYear(
              TblPerson $tblPerson,
              TblYear $tblYear
          ) {
      Severity: Minor
      Found in Application/Education/Lesson/Division/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

      Function countDivisionSubjectForSubjectTeacherByDivision has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          public
          function countDivisionSubjectForSubjectTeacherByDivision(
              TblDivision $tblDivision
          ) {
      
      
      Severity: Minor
      Found in Application/Education/Lesson/Division/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

      Function addSubjectWithoutGroups has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          public
          function addSubjectWithoutGroups(
              TblDivision $tblDivision,
              TblDivision $tblDivisionCopy
          ) {
      Severity: Minor
      Found in Application/Education/Lesson/Division/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

      Function sortDivisionStudentWithGenderByProperty has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          public function sortDivisionStudentWithGenderByProperty(
              TblDivision $tblDivision,
              $Property = 'LastFirstName',
              $Sorter = null,
              $Order = Sorter::ORDER_ASC
      Severity: Minor
      Found in Application/Education/Lesson/Division/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

      Function createLevelDivision has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createLevelDivision(
              IFormInterface $Form,
              $Level,
              $Division
          ) {
      Severity: Minor
      Found in Application/Education/Lesson/Division/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 copyDivision has 100 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public
          function copyDivision(
              IFormInterface $Form,
              TblDivision $tblDivision,
              $Level,
      Severity: Major
      Found in Application/Education/Lesson/Division/Service.php - About 4 hrs to fix

        Function getSubjectTeacherNameList has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            public
            function getSubjectTeacherNameList(
                TblDivision $tblDivision,
                TblSubject $tblSubject,
                TblSubjectGroup $tblSubjectGroup = null
        Severity: Minor
        Found in Application/Education/Lesson/Division/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

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

            public function getDivisionAllByName($divisionName, TblYear $tblYear = null, TblType $tblType = null)
            {
        
                $divisionList = array();
                $divisionName = str_replace(' ', '', $divisionName);
        Severity: Minor
        Found in Application/Education/Lesson/Division/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

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

            public
            function countDivisionSubjectGroupTeacherByDivision(
                TblDivision $tblDivision
            ) {
        
        
        Severity: Minor
        Found in Application/Education/Lesson/Division/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

        Function changeSubjectGroup has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public function changeSubjectGroup(
                IFormInterface $Form,
                $Group,
                $Id,
                $DivisionId,
        Severity: Minor
        Found in Application/Education/Lesson/Division/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

        Method addSubjectWithGroups has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addSubjectWithGroups(
                TblDivision $tblDivision,
                TblDivision $tblDivisionCopy
            ) {
        
        
        Severity: Major
        Found in Application/Education/Lesson/Division/Service.php - About 2 hrs to fix

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

              public function createLevelDivision(
                  IFormInterface $Form,
                  $Level,
                  $Division
              ) {
          Severity: Major
          Found in Application/Education/Lesson/Division/Service.php - About 2 hrs to fix

            Function addSubjectToDivisionWithGroup has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function addSubjectToDivisionWithGroup(
                    IFormInterface $Form,
                    TblDivision $tblDivision,
                    TblSubject $tblSubject,
                    $Group,
            Severity: Minor
            Found in Application/Education/Lesson/Division/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

            Method sortDivisionStudentWithGenderByProperty has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function sortDivisionStudentWithGenderByProperty(
                    TblDivision $tblDivision,
                    $Property = 'LastFirstName',
                    $Sorter = null,
                    $Order = Sorter::ORDER_ASC
            Severity: Major
            Found in Application/Education/Lesson/Division/Service.php - About 2 hrs to fix

              Function removeSubjectToDivision has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public
                  function removeSubjectToDivision(
                      TblDivision $tblDivision,
                      TblSubject $tblSubject
                  ) {
              Severity: Minor
              Found in Application/Education/Lesson/Division/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 changeSubjectGroup has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function changeSubjectGroup(
                      IFormInterface $Form,
                      $Group,
                      $Id,
                      $DivisionId,
              Severity: Minor
              Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

                Function getDivisionAllByTeacher has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    public
                    function getDivisionAllByTeacher(
                        TblPerson $tblPerson
                    ) {
                
                
                Severity: Minor
                Found in Application/Education/Lesson/Division/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 addSubjectToDivisionWithGroup has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addSubjectToDivisionWithGroup(
                        IFormInterface $Form,
                        TblDivision $tblDivision,
                        TblSubject $tblSubject,
                        $Group,
                Severity: Minor
                Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

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

                      public
                      function getMinDivisionByLevelType(
                          TblType $tblType
                      ) {
                  
                  
                  Severity: Minor
                  Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

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

                        public function removePerson(TblPerson $tblPerson, $IsSoftRemove = false)
                        {
                    
                            if (($tblDivisionCustodyAllByPerson = $this->getDivisionCustodyAllByPerson($tblPerson))){
                                foreach($tblDivisionCustodyAllByPerson as $tblDivisionCustody){
                    Severity: Minor
                    Found in Application/Education/Lesson/Division/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 removePerson has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function removePerson(TblPerson $tblPerson, $IsSoftRemove = false)
                        {
                    
                            if (($tblDivisionCustodyAllByPerson = $this->getDivisionCustodyAllByPerson($tblPerson))){
                                foreach($tblDivisionCustodyAllByPerson as $tblDivisionCustody){
                    Severity: Minor
                    Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

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

                          public function getStudentCountByYear(TblYear $tblYear)
                          {
                      
                              $countStudentsByYear = 0;
                              if (($tblDivisionList = $this->getDivisionAllByYear($tblYear))) {
                      Severity: Minor
                      Found in Application/Education/Lesson/Division/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

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

                          public function getDivisionSubjectByDivision(TblDivision $tblDivision, $isListWithSubjectGroup = true)
                          {
                      
                              if ($isListWithSubjectGroup) {
                                  return (new Data($this->getBinding()))->getDivisionSubjectByDivision($tblDivision);
                      Severity: Minor
                      Found in Application/Education/Lesson/Division/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

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

                          public function getSubjectStudentByPersonAndDivision(TblPerson $tblPerson, TblDivision $tblDivision)
                          {
                      
                              $resultList = array();
                              $tblSubjectStudentList = (new Data($this->getBinding()))->getSubjectStudentByPerson($tblPerson);
                      Severity: Minor
                      Found in Application/Education/Lesson/Division/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 countDivisionSubjectForSubjectTeacherByDivision has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public
                          function countDivisionSubjectForSubjectTeacherByDivision(
                              TblDivision $tblDivision
                          ) {
                      
                      
                      Severity: Minor
                      Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

                        Method getDivisionAllByName has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getDivisionAllByName($divisionName, TblYear $tblYear = null, TblType $tblType = null)
                            {
                        
                                $divisionList = array();
                                $divisionName = str_replace(' ', '', $divisionName);
                        Severity: Minor
                        Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

                          Method getDivisionSubjectAllByPersonAndYear has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public
                              function getDivisionSubjectAllByPersonAndYear(
                                  TblPerson $tblPerson,
                                  TblYear $tblYear
                              ) {
                          Severity: Minor
                          Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

                            Method addSubjectWithoutGroups has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public
                                function addSubjectWithoutGroups(
                                    TblDivision $tblDivision,
                                    TblDivision $tblDivisionCopy
                                ) {
                            Severity: Minor
                            Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

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

                                  public
                                  function getSubjectTeacherNameList(
                                      TblDivision $tblDivision,
                                      TblSubject $tblSubject,
                                      TblSubjectGroup $tblSubjectGroup = null
                              Severity: Minor
                              Found in Application/Education/Lesson/Division/Service.php - About 1 hr to fix

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

                                    public function getDivisionByPersonAndYear(TblPerson $tblPerson, TblYear $tblYear)
                                    {
                                
                                        $tblDivisionList = $this->getDivisionByYear($tblYear);
                                        if ($tblDivisionList) {
                                Severity: Minor
                                Found in Application/Education/Lesson/Division/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

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

                                    public
                                    function changeDivision(
                                        IFormInterface $Form,
                                        $Division,
                                        $Id
                                Severity: Minor
                                Found in Application/Education/Lesson/Division/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

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

                                        IFormInterface $Form,
                                        $Group,
                                        $Id,
                                        $DivisionId,
                                        $DivisionSubjectId,
                                Severity: Minor
                                Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                  Function updateDivisionSubject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function updateDivisionSubject(
                                          IFormInterface $Form,
                                          TblDivision $tblDivision,
                                          $Data
                                      ) {
                                  Severity: Minor
                                  Found in Application/Education/Lesson/Division/Service.php - About 45 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

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

                                          IFormInterface $Form,
                                          TblDivision $tblDivision,
                                          TblSubject $tblSubject,
                                          $Group,
                                          $DivisionSubjectId,
                                  Severity: Minor
                                  Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                                            if ($this->exitsSubjectStudent($item, $tblPerson)) {
                                                                                $resultList[$item->getId()] = $item;
                                                                            }
                                    Severity: Major
                                    Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                                  if (!$SubjectTeacherList && !$tblSubjectTeacherList) {
                                                                      $TeacherGroupCount++;
                                                                  }
                                      Severity: Major
                                      Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                                            if ($tblDivision->getServiceTblYear()
                                                                                && $tblYear->getId() === $tblDivision->getServiceTblYear()->getId()
                                                                            ) {
                                                                                $DivisionList[] = $tblDivision;
                                                                            }
                                        Severity: Major
                                        Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                          Function getOtherDivisionsByStudent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              public function getOtherDivisionsByStudent(
                                                  TblDivision $tblDivision,
                                                  TblPerson $tblPerson,
                                                  $withCurrentDivision = true
                                              ) {
                                          Severity: Minor
                                          Found in Application/Education/Lesson/Division/Service.php - About 45 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 ($tblSubjectTeacher->getServiceTblPerson()) {
                                                                                  (new Data($this->getBinding()))->addSubjectTeacher($tblDivisionSubjectCopy,
                                                                                      $tblSubjectTeacher->getServiceTblPerson());
                                                                              }
                                          Severity: Major
                                          Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                        if ($tblGender->getName() == 'Männlich') {
                                                                            $maleList[] = $tblStudent;
                                                                            continue;
                                                                        } elseif ($tblGender->getName() == 'Weiblich') {
                                                                            $femaleList[] = $tblStudent;
                                            Severity: Major
                                            Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                              Function getDivisionByDivisionNameAndLevelAndYear has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function getDivisionByDivisionNameAndLevelAndYear($Name, TblLevel $tblLevel = null, TblYear $tblYear)
                                                  {
                                              
                                                      if ($tblYear && $tblLevel && $Name != '') {
                                                          $tblDivisionList = array();
                                              Severity: Minor
                                              Found in Application/Education/Lesson/Division/Service.php - About 45 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 ($SubjectTeacherList) {
                                                                                      $TeacherGroup[] = true;
                                                                                  }
                                              Severity: Major
                                              Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                                if ((count($tblDivisionSubjectActiveList) - 1) == count($TeacherGroup)) {
                                                                                    $SubjectUsedCount--;
                                                                                }
                                                Severity: Major
                                                Found in Application/Education/Lesson/Division/Service.php - About 45 mins to fix

                                                  Consider simplifying this complex logical expression.
                                                  Open

                                                          if ($tblYear && $tblLevel && $Name != '') {
                                                              $tblDivisionList = array();
                                                              if (( $tblDivision = ( new Data($this->getBinding()) )->getDivisionByDivisionNameAndLevelAndYear($Name, $tblLevel, $tblYear) )) {
                                                                  $tblDivisionList[] = $tblDivision;
                                                                  return $tblDivisionList;
                                                  Severity: Major
                                                  Found in Application/Education/Lesson/Division/Service.php - About 40 mins to fix

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

                                                        public function getDivisionAllByYearAndType(TblYear $tblYear, TblType $tblType)
                                                        {
                                                    
                                                            $result = array();
                                                    
                                                    
                                                    Severity: Minor
                                                    Found in Application/Education/Lesson/Division/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 removeStudentToDivision has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        public function removeStudentToDivision(TblDivision $tblDivision, TblPerson $tblPerson, $IsSoftRemove = false)
                                                        {
                                                    
                                                            $tblStudentSubjectList = (new Data($this->getBinding()))->getSubjectStudentByPerson($tblPerson);
                                                            if ($tblStudentSubjectList) {
                                                    Severity: Minor
                                                    Found in Application/Education/Lesson/Division/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 addAllAvailableStudentsToSubjectGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        public function addAllAvailableStudentsToSubjectGroup(TblDivisionSubject $tblDivisionSubject)
                                                        {
                                                    
                                                            $filter = new Filter($tblDivisionSubject);
                                                            $filter->load();
                                                    Severity: Minor
                                                    Found in Application/Education/Lesson/Division/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 getSubjectGroupByNameAndDivisionAndSubject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        public function getSubjectGroupByNameAndDivisionAndSubject($Name, TblDivision $tblDivision, TblSubject $tblSubject)
                                                        {
                                                    
                                                            $tblDivisionSubjectList = Division::useService()->getDivisionSubjectAllWhereSubjectGroupByDivisionAndSubject($tblDivision, $tblSubject);
                                                            if ($tblDivisionSubjectList) {
                                                    Severity: Minor
                                                    Found in Application/Education/Lesson/Division/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

                                                    Avoid too many return statements within this method.
                                                    Open

                                                            return $Form;
                                                    Severity: Major
                                                    Found in Application/Education/Lesson/Division/Service.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                              return $Form;
                                                      Severity: Major
                                                      Found in Application/Education/Lesson/Division/Service.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    return false;
                                                        Severity: Major
                                                        Found in Application/Education/Lesson/Division/Service.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return $Form;
                                                          Severity: Major
                                                          Found in Application/Education/Lesson/Division/Service.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                    return $Form;
                                                            Severity: Major
                                                            Found in Application/Education/Lesson/Division/Service.php - About 30 mins to fix

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

                                                                  public function getPersonAllByDivisionList($tblDivisionList)
                                                                  {
                                                              
                                                                      $tblPersonList = array();
                                                                      if (!empty($tblDivisionList)) {
                                                              Severity: Minor
                                                              Found in Application/Education/Lesson/Division/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 destroyLevel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public
                                                                  function destroyLevel(
                                                                      TblLevel $tblLevel
                                                                  ) {
                                                              
                                                              
                                                              Severity: Minor
                                                              Found in Application/Education/Lesson/Division/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 sortDivisionStudentByProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                              Open

                                                                  public function sortDivisionStudentByProperty(
                                                                      TblDivision $tblDivision,
                                                                      $Property = 'LastFirstName',
                                                                      $Sorter = null,
                                                                      $Order = Sorter::ORDER_ASC
                                                              Severity: Minor
                                                              Found in Application/Education/Lesson/Division/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

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

                                                                      if (!$Error) {
                                                                          $tblLevel = null;
                                                                          if (!isset($Level['Check'])) {
                                                                              if (isset($Level['Name']) && empty($Level['Name'])) {
                                                                                  $Form->setError('Level[Name]', 'Bitte geben Sie eine Klassenstufe für die Schulart an <br/>');
                                                              Severity: Major
                                                              Found in Application/Education/Lesson/Division/Service.php and 1 other location - About 5 hrs to fix
                                                              Application/Education/Lesson/Division/Service.php on lines 1891..1908

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

                                                              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 (!$Error) {
                                                                          $tblLevel = null;
                                                                          if (!isset($Level['Check'])) {
                                                                              if (isset($Level['Name']) && empty($Level['Name'])) {
                                                                                  $Form->setError('Level[Name]', 'Bitte geben Sie eine Klassenstufe für die Schulart an <br/>');
                                                              Severity: Major
                                                              Found in Application/Education/Lesson/Division/Service.php and 1 other location - About 5 hrs to fix
                                                              Application/Education/Lesson/Division/Service.php on lines 192..209

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

                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                              Refactorings

                                                              Further Reading

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

                                                                  public
                                                                  function destroyLevel(
                                                                      TblLevel $tblLevel
                                                                  ) {
                                                              
                                                              
                                                              Severity: Major
                                                              Found in Application/Education/Lesson/Division/Service.php and 1 other location - About 4 hrs to fix
                                                              Application/Education/Lesson/Term/Service.php on lines 620..642

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

                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                              Refactorings

                                                              Further Reading

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

                                                                      if (!isset($Level['Check']) && isset($Level['Name'])) {
                                                                          if (is_numeric($Level['Name'])) {
                                                                              $position = strpos($Level['Name'], '0');
                                                                              if ($position === 0) {
                                                                                  $Form->setError('Level[Name]', 'Bitte geben Sie eine Zahl ohne führende "0" ein');
                                                              Severity: Major
                                                              Found in Application/Education/Lesson/Division/Service.php and 1 other location - About 1 hr to fix
                                                              Application/Education/Lesson/Division/Service.php on lines 178..189

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

                                                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                              Refactorings

                                                              Further Reading

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

                                                                      if (!isset($Level['Check']) && isset($Level['Name'])) {
                                                                          if (is_numeric($Level['Name'])) {
                                                                              $position = strpos($Level['Name'], '0');
                                                                              if ($position === 0) {
                                                                                  $Form->setError('Level[Name]', 'Bitte geben Sie eine Zahl ohne führende "0" ein');
                                                              Severity: Major
                                                              Found in Application/Education/Lesson/Division/Service.php and 1 other location - About 1 hr to fix
                                                              Application/Education/Lesson/Division/Service.php on lines 1877..1888

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

                                                              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