DerDu/SPHERE-Framework

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

Summary

Maintainability
F
1 wk
Test Coverage

Function getDivisionMessageTable has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDivisionMessageTable(TblDivision $tblDivision, $isAccordion = false, &$totalCount, $IsTableAccordion = false)
    {

        $list = array();
        $missingGroupList = array();
Severity: Minor
Found in Application/Education/Lesson/Division/Filter/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 formatFilterListMessages has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

    private static function formatFilterListMessages($list, $contentTable, &$count, $countMessages)
    {

        $hasEditButton = true;
        $tblStudentGroup = Group::useService()->getGroupByMetaTable('STUDENT');
Severity: Minor
Found in Application/Education/Lesson/Division/Filter/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 hasPersonAllObligations has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

    public static function hasPersonAllObligations(TblPerson $tblPerson, TblType $tblSchoolType, TblLevel $tblLevel, $list, $validateFirstLanguage, $hasOrientationSubjects)
    {
        $tblStudent = $tblPerson->getStudent();

        // Keine 1. Fremdsprache hinterlegt.
Severity: Minor
Found in Application/Education/Lesson/Division/Filter/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

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

<?php
/**
 * Created by PhpStorm.
 * User: Kauschke
 * Date: 07.06.2018
Severity: Major
Found in Application/Education/Lesson/Division/Filter/Service.php - About 1 day to fix

    Function getPersonMessageTable has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getPersonMessageTable(TblPerson $tblPerson)
        {
            if (($tblStudent = $tblPerson->getStudent())
                && ($tblDivisionList = $tblStudent->getCurrentDivisionList())
            ) {
    Severity: Minor
    Found in Application/Education/Lesson/Division/Filter/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

    Method getDivisionMessageTable has 162 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getDivisionMessageTable(TblDivision $tblDivision, $isAccordion = false, &$totalCount, $IsTableAccordion = false)
        {
    
            $list = array();
            $missingGroupList = array();
    Severity: Major
    Found in Application/Education/Lesson/Division/Filter/Service.php - About 6 hrs to fix

      Method hasPersonAllObligations has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function hasPersonAllObligations(TblPerson $tblPerson, TblType $tblSchoolType, TblLevel $tblLevel, $list, $validateFirstLanguage, $hasOrientationSubjects)
          {
              $tblStudent = $tblPerson->getStudent();
      
              // Keine 1. Fremdsprache hinterlegt.
      Severity: Major
      Found in Application/Education/Lesson/Division/Filter/Service.php - About 4 hrs to fix

        Method getPersonMessageTable has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getPersonMessageTable(TblPerson $tblPerson)
            {
                if (($tblStudent = $tblPerson->getStudent())
                    && ($tblDivisionList = $tblStudent->getCurrentDivisionList())
                ) {
        Severity: Major
        Found in Application/Education/Lesson/Division/Filter/Service.php - About 3 hrs to fix

          Method formatFilterListMessages has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function formatFilterListMessages($list, $contentTable, &$count, $countMessages)
              {
          
                  $hasEditButton = true;
                  $tblStudentGroup = Group::useService()->getGroupByMetaTable('STUDENT');
          Severity: Major
          Found in Application/Education/Lesson/Division/Filter/Service.php - About 2 hrs to fix

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

                public static function hasDivisionAllObligations(TblDivision $tblDivision, $list)
                {
                    if (($tblLevel = $tblDivision->getTblLevel())
                        && ($tblSchoolType = $tblLevel->getServiceTblType())
                        && ($tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision))
            Severity: Minor
            Found in Application/Education/Lesson/Division/Filter/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 hasDivisionAllObligations has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function hasDivisionAllObligations(TblDivision $tblDivision, $list)
                {
                    if (($tblLevel = $tblDivision->getTblLevel())
                        && ($tblSchoolType = $tblLevel->getServiceTblType())
                        && ($tblPersonList = Division::useService()->getStudentAllByDivision($tblDivision))
            Severity: Minor
            Found in Application/Education/Lesson/Division/Filter/Service.php - About 1 hr to fix

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

                  public static function hasPersonAllObligations(TblPerson $tblPerson, TblType $tblSchoolType, TblLevel $tblLevel, $list, $validateFirstLanguage, $hasOrientationSubjects)
              Severity: Minor
              Found in Application/Education/Lesson/Division/Filter/Service.php - About 45 mins to fix

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

                            if (preg_match('!(0?(7|8|9|10))!is', $tblLevel->getName())) {
                                if (!$tblStudent
                                    || (!$tblStudent->getCourse())
                                ) {
                                    $field = Filter::DESCRIPTION_COURSE;
                Severity: Major
                Found in Application/Education/Lesson/Division/Filter/Service.php and 1 other location - About 6 hrs to fix
                Application/Education/Lesson/Division/Filter/Service.php on lines 563..581

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

                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 (preg_match('!(0?(8|9|10))!is', $tblLevel->getName())) {
                                if (!$tblStudent
                                    || !$tblStudent->getTblSubjectProfile()
                                ) {
                                    $field = Filter::DESCRIPTION_SUBJECT_PROFILE;
                Severity: Major
                Found in Application/Education/Lesson/Division/Filter/Service.php and 1 other location - About 6 hrs to fix
                Application/Education/Lesson/Division/Filter/Service.php on lines 516..534

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

                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 ($checkProfile && !empty($profileList) && count($profileList) > 1) {
                                foreach ($profileList as $tblSubjectItem) {
                                    if (!Division::useService()->exitsSubjectGroup($tblDivision, $tblSubjectItem)) {
                                        $missingGroupList[] = new Exclamation() .
                                            ($isAccordion ? ' In der Klasse ' . $tblDivision->getDisplayName()
                Severity: Major
                Found in Application/Education/Lesson/Division/Filter/Service.php and 1 other location - About 1 hr to fix
                Application/Education/Lesson/Division/Filter/Service.php on lines 183..193

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

                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 ($checkOrientation && !empty($orientationList) && count($orientationList) > 1) {
                                foreach ($orientationList as $tblSubjectItem) {
                                    if (!Division::useService()->exitsSubjectGroup($tblDivision, $tblSubjectItem)) {
                                        $missingGroupList[] = new Exclamation() .
                                            ($isAccordion ? ' In der Klasse ' . $tblDivision->getDisplayName()
                Severity: Major
                Found in Application/Education/Lesson/Division/Filter/Service.php and 1 other location - About 1 hr to fix
                Application/Education/Lesson/Division/Filter/Service.php on lines 172..182

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

                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