DerDu/SPHERE-Framework

View on GitHub
Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php

Summary

Maintainability
F
1 wk
Test Coverage

Function setContent has a Cognitive Complexity of 259 (exceeds 5 allowed). Consider refactoring.
Open

    private function setContent(
        TblDivision $tblDivision,
        TblSubject $tblSubject,
        TblSubjectGroup $tblSubjectGroup = null,
        TblPeriod $tblPeriod,
Severity: Minor
Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php - About 5 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

Method setContent has 660 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function setContent(
        TblDivision $tblDivision,
        TblSubject $tblSubject,
        TblSubjectGroup $tblSubjectGroup = null,
        TblPeriod $tblPeriod,
Severity: Major
Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php - About 3 days to fix

    File Gradebook.php has 811 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace SPHERE\Application\Api\Document\Standard\Repository\Gradebook;
    
    use SPHERE\Application\Document\Generator\Repository\Document;
    use SPHERE\Application\Document\Generator\Repository\Element;
    Severity: Major
    Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php - About 1 day to fix

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

          public function buildPage(
              TblDivisionSubject $tblDivisionSubject,
              TblPeriod $tblPeriod,
              $isLastPeriod = false
          ) {

        Avoid deeply nested control flow statements.
        Open

                                            if (($tblGrade = \SPHERE\Application\Education\Graduation\Gradebook\Gradebook::useService()
                                                    ->getGradeByTestAndStudent($tblTest, $tblPerson))
                                                && $tblGrade->getGrade() !== false && $tblGrade->getGrade() !== null
                                            ) {
                                                $grade = $tblGrade->getDisplayGrade();
        Severity: Major
        Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php - About 45 mins to fix

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

              private function setHeaderTest(Section $section, $text, $width, $isBold = false, $hasBorderRight = false)
          Severity: Minor
          Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php - About 35 mins to fix

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

                    TblDivision $tblDivision,
                    TblSubject $tblSubject,
                    TblSubjectGroup $tblSubjectGroup = null,
                    TblPeriod $tblPeriod,
                    $isLastPeriod = false
            Severity: Minor
            Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.php - About 35 mins to fix

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

                  public function buildDocument($pageList = array())
                  {
                      $document = new Document();
              
                      foreach ($pageList as $subjectPages) {
              Severity: Minor
              Found in Application/Api/Document/Standard/Repository/Gradebook/Gradebook.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

              There are no issues that match your filters.

              Category
              Status