DerDu/SPHERE-Framework

View on GitHub
Application/Education/ClassRegister/Absence/Frontend.php

Summary

Maintainability
F
2 wks
Test Coverage

Function frontendEditAbsenceMonth has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
Open

    public function frontendEditAbsenceMonth(
        $DivisionId = null,
        $Month = null,
        $Year = null,
        $BasicRoute = '',
Severity: Minor
Found in Application/Education/ClassRegister/Absence/Frontend.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 frontendAbsenceMonth has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
Open

    public function frontendAbsenceMonth($DivisionId = null, $Month = null, $Year = null, $BasicRoute = '')
    {

        $Stage = new Stage('Fehlzeiten', 'Monatsübersicht');
        $tblDivision = Division::useService()->getDivisionById($DivisionId);
Severity: Minor
Found in Application/Education/ClassRegister/Absence/Frontend.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

File Frontend.php has 839 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by PhpStorm.
 * User: Kauschke
 * Date: 08.07.2016
Severity: Major
Found in Application/Education/ClassRegister/Absence/Frontend.php - About 2 days to fix

    Method frontendEditAbsenceMonth has 244 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function frontendEditAbsenceMonth(
            $DivisionId = null,
            $Month = null,
            $Year = null,
            $BasicRoute = '',
    Severity: Major
    Found in Application/Education/ClassRegister/Absence/Frontend.php - About 1 day to fix

      Method frontendAbsenceMonth has 203 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function frontendAbsenceMonth($DivisionId = null, $Month = null, $Year = null, $BasicRoute = '')
          {
      
              $Stage = new Stage('Fehlzeiten', 'Monatsübersicht');
              $tblDivision = Division::useService()->getDivisionById($DivisionId);
      Severity: Major
      Found in Application/Education/ClassRegister/Absence/Frontend.php - About 1 day to fix

        Method frontendAbsence has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function frontendAbsence(
                $DivisionId = null,
                $PersonId = null,
                $BasicRoute = '/Education/ClassRegister/Teacher',
                $Data = null
        Severity: Major
        Found in Application/Education/ClassRegister/Absence/Frontend.php - About 4 hrs to fix

          Method frontendDestroyAbsence has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function frontendDestroyAbsence($Id = null, $Confirm = false, $BasicRoute = '')
              {
          
                  $Stage = new Stage('Fehlzeit', 'Löschen');
          
          
          Severity: Major
          Found in Application/Education/ClassRegister/Absence/Frontend.php - About 3 hrs to fix

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

                public function frontendAbsence(
                    $DivisionId = null,
                    $PersonId = null,
                    $BasicRoute = '/Education/ClassRegister/Teacher',
                    $Data = null
            Severity: Minor
            Found in Application/Education/ClassRegister/Absence/Frontend.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 frontendEditAbsence has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function frontendEditAbsence($Id = null, $BasicRoute = '', $Data = null)
                {
            
                    $Stage = new Stage('Fehlzeiten', 'Bearbeiten');
                    $tblAbsence = Absence::useService()->getAbsenceById($Id);
            Severity: Major
            Found in Application/Education/ClassRegister/Absence/Frontend.php - About 2 hrs to fix

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

                  private function setStatusForDay(
                      TblPerson $tblPerson,
                      TblAbsence $tblAbsence,
                      TblYear $tblYear,
                      &$studentTable,
              Severity: Minor
              Found in Application/Education/ClassRegister/Absence/Frontend.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 setStatusForDay has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      TblPerson $tblPerson,
                      TblAbsence $tblAbsence,
                      TblYear $tblYear,
                      &$studentTable,
                      \DateTime $date,
              Severity: Major
              Found in Application/Education/ClassRegister/Absence/Frontend.php - About 1 hr to fix

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

                    private function formAbsence()
                    {
                
                        return new Form(new FormGroup(array(
                            new FormRow(array(
                Severity: Minor
                Found in Application/Education/ClassRegister/Absence/Frontend.php - About 1 hr to fix

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

                          $DivisionId = null,
                          $Month = null,
                          $Year = null,
                          $BasicRoute = '',
                          $SelectedDate = null,
                  Severity: Minor
                  Found in Application/Education/ClassRegister/Absence/Frontend.php - About 45 mins to fix

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

                        public function frontendDestroyAbsence($Id = null, $Confirm = false, $BasicRoute = '')
                        {
                    
                            $Stage = new Stage('Fehlzeit', 'Löschen');
                    
                    
                    Severity: Minor
                    Found in Application/Education/ClassRegister/Absence/Frontend.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 ($tblYear) {
                                    $tblLevel = $tblDivision->getTblLevel();
                                    $tblPeriodList = Term::useService()->getPeriodAllByYear($tblYear, $tblLevel && $tblLevel->getName() == '12');
                                    if ($tblPeriodList) {
                                        foreach ($tblPeriodList as $tblPeriod) {
                    Severity: Major
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 1 day to fix
                    Application/Education/ClassRegister/Absence/Frontend.php on lines 337..363

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                                if ($tblYear) {
                                    $tblLevel = $tblDivision->getTblLevel();
                                    $tblPeriodList = Term::useService()->getPeriodAllByYear($tblYear, $tblLevel && $tblLevel->getName() == '12');
                                    if ($tblPeriodList) {
                                        foreach ($tblPeriodList as $tblPeriod) {
                    Severity: Major
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 1 day to fix
                    Application/Education/ClassRegister/Absence/Frontend.php on lines 727..753

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

                    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 ($startDate && $endDate) {
                                    while ($startDate <= $endDate) {
                                        $startDateYear = $startDate->format('Y');
                                        $startDateMonth = $startDate->format('m');
                                        $buttonList[] = new Standard(
                    Severity: Major
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 3 hrs to fix
                    Application/Education/ClassRegister/Absence/Frontend.php on lines 783..802

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

                    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 ($startDate && $endDate) {
                                    while ($startDate <= $endDate) {
                                        $startDateYear = $startDate->format('Y');
                                        $startDateMonth = $startDate->format('m');
                                        $buttonList[] = new Standard(
                    Severity: Major
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 3 hrs to fix
                    Application/Education/ClassRegister/Absence/Frontend.php on lines 393..412

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

                    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 ($date->format('w') != 0 && $date->format('w') != 6) {
                                        if (Term::useService()->getHolidayByDay($tblYear, $date)) {
                                            $holidays[$i] = new Muted(new Small('f'));
                                        } else {
                                            $holidays[$i] = '';
                    Severity: Major
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 1 hr to fix
                    Application/Education/ClassRegister/Absence/Frontend.php on lines 825..833

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

                    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 ($date->format('w') != 0 && $date->format('w') != 6) {
                                        if (Term::useService()->getHolidayByDay($tblYear, $date)) {
                                            $holidays[$i] = new Muted(new Small('f'));
                                        } else {
                                            $holidays[$i] = '';
                    Severity: Major
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 1 hr to fix
                    Application/Education/ClassRegister/Absence/Frontend.php on lines 444..452

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

                    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 ($Data === null) {
                                    $Global = $this->getGlobal();
                                    $Global->POST['Data']['FromDate'] = $tblAbsence->getFromDate();
                                    $Global->POST['Data']['ToDate'] = $tblAbsence->getToDate();
                                    $Global->POST['Data']['Remark'] = $tblAbsence->getRemark();
                    Severity: Minor
                    Found in Application/Education/ClassRegister/Absence/Frontend.php and 1 other location - About 50 mins to fix
                    Application/Api/Billing/Accounting/ApiBankAccount.php on lines 456..463

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

                    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