DerDu/SPHERE-Framework

View on GitHub
Application/Transfer/Indiware/Export/AppointmentGrade/Service.php

Summary

Maintainability
F
4 days
Test Coverage

Function getStudentGradeList has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStudentGradeList($TaskId = false)
    {

        $tblTask = Evaluation::useService()->getTaskById($TaskId);
        if (!$tblTask) {
Severity: Minor
Found in Application/Transfer/Indiware/Export/AppointmentGrade/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 getStudentExistInTaskList has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStudentExistInTaskList($TaskId = false)
    {
        $tblTask = Evaluation::useService()->getTaskById($TaskId);
        if (!$tblTask) {
            return false;
Severity: Minor
Found in Application/Transfer/Indiware/Export/AppointmentGrade/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

Method getStudentGradeList has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getStudentGradeList($TaskId = false)
    {

        $tblTask = Evaluation::useService()->getTaskById($TaskId);
        if (!$tblTask) {
Severity: Major
Found in Application/Transfer/Indiware/Export/AppointmentGrade/Service.php - About 3 hrs to fix

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

        public function getStudentExistInTaskList($TaskId = false)
        {
            $tblTask = Evaluation::useService()->getTaskById($TaskId);
            if (!$tblTask) {
                return false;
    Severity: Minor
    Found in Application/Transfer/Indiware/Export/AppointmentGrade/Service.php - About 1 hr to fix

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

          public function createGradeListCsv($Period, $TaskId)
          {
      
              $PeopleGradeList = $this->getStudentGradeList($TaskId);
      
      
      Severity: Minor
      Found in Application/Transfer/Indiware/Export/AppointmentGrade/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 createGradeListCsv has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createGradeListCsv($Period, $TaskId)
          {
      
              $PeopleGradeList = $this->getStudentGradeList($TaskId);
      
      
      Severity: Minor
      Found in Application/Transfer/Indiware/Export/AppointmentGrade/Service.php - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                    if ($GradeList) {
                                        foreach ($GradeList as $Grade) {
                                            // stop search if every Person got found
                                            if (empty($PersonList)) {
                                                break;
        Severity: Major
        Found in Application/Transfer/Indiware/Export/AppointmentGrade/Service.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if ($tblGradeList) {
          
                                          foreach ($tblGradeList as $tblGrade) {
                                              $tblPersonStudent = $tblGrade->getServiceTblPerson();
                                              if ($tblPersonStudent) {
          Severity: Major
          Found in Application/Transfer/Indiware/Export/AppointmentGrade/Service.php - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status