DerDu/SPHERE-Framework

View on GitHub
Application/Document/Generator/Service.php

Summary

Maintainability
F
1 wk
Test Coverage

Function setStudentCardContent has a Cognitive Complexity of 228 (exceeds 5 allowed). Consider refactoring.
Open

    public function setStudentCardContent(
        $Data,
        TblPerson $tblPerson,
        AbstractDocument $documentClass,
        TblType $tblType = null
Severity: Minor
Found in Application/Document/Generator/Service.php - About 4 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 setStudentCardContent has 289 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setStudentCardContent(
        $Data,
        TblPerson $tblPerson,
        AbstractDocument $documentClass,
        TblType $tblType = null
Severity: Major
Found in Application/Document/Generator/Service.php - About 1 day to fix

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

    <?php
    /**
     * Created by PhpStorm.
     * User: Kauschke
     * Date: 08.03.2017
    Severity: Major
    Found in Application/Document/Generator/Service.php - About 1 day to fix

      Function getCourses has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getCourses(TblPerson $tblPerson, TblDivision $tblDivision, $advancedCourses, $basicCourses)
          {
      
              if (($tblDivisionSubjectList = Division::useService()->getDivisionSubjectByDivision($tblDivision))) {
                  foreach ($tblDivisionSubjectList as $tblDivisionSubjectItem) {
      Severity: Minor
      Found in Application/Document/Generator/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 getStudentCardSubjectListByPerson has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getStudentCardSubjectListByPerson(TblPerson $tblPerson, AbstractDocument $documentClass)
          {
      
              $resultList = array();
              $list = array();
      Severity: Minor
      Found in Application/Document/Generator/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

      Function getStudentCardSubjectListForSekIIByPerson has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getStudentCardSubjectListForSekIIByPerson(TblPerson $tblPerson)
          {
      
              $resultList = array();
              $list = array();
      Severity: Minor
      Found in Application/Document/Generator/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 getPrepareStudentListForStudentCard has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getPrepareStudentListForStudentCard(TblPerson $tblPerson, TblType $tblType = null)
          {
      
              $list = array();
              if (($tblDivisionStudentList = Division::useService()->getDivisionStudentAllByPerson($tblPerson))) {
      Severity: Minor
      Found in Application/Document/Generator/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 createDocumentSubjects has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createDocumentSubjects(
              IFormInterface $Form,
              TblDocument $tblDocument,
              $Data
          ) {
      Severity: Minor
      Found in Application/Document/Generator/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 getStudentCardSubjectListForSekIIByPerson has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getStudentCardSubjectListForSekIIByPerson(TblPerson $tblPerson)
          {
      
              $resultList = array();
              $list = array();
      Severity: Minor
      Found in Application/Document/Generator/Service.php - About 1 hr to fix

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

            public function getStudentCardSubjectListByPerson(TblPerson $tblPerson, AbstractDocument $documentClass)
            {
        
                $resultList = array();
                $list = array();
        Severity: Minor
        Found in Application/Document/Generator/Service.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                                  if ($tblPrepare->getServiceTblGenerateCertificate()
                                      && ($tblCertificateType = $tblPrepare->getServiceTblGenerateCertificate()->getServiceTblCertificateType())
                                      && ($tblCertificateType->getIdentifier() == 'HALF_YEAR'
                                          || $tblCertificateType->getIdentifier() == 'YEAR'
                                          || $tblCertificateType->getIdentifier() == 'MID_TERM_COURSE'
          Severity: Critical
          Found in Application/Document/Generator/Service.php - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                                    if ($tblPrepare->getServiceTblGenerateCertificate()
                                        && ($tblCertificateType = $tblPrepare->getServiceTblGenerateCertificate()->getServiceTblCertificateType())
                                        && ($tblCertificateType->getIdentifier() == 'HALF_YEAR'
                                            || $tblCertificateType->getIdentifier() == 'YEAR'
                                            || $tblCertificateType->getIdentifier() == 'MID_TERM_COURSE'
            Severity: Critical
            Found in Application/Document/Generator/Service.php - About 1 hr to fix

              Method getPrepareStudentListForStudentCard has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getPrepareStudentListForStudentCard(TblPerson $tblPerson, TblType $tblType = null)
                  {
              
                      $list = array();
                      if (($tblDivisionStudentList = Division::useService()->getDivisionStudentAllByPerson($tblPerson))) {
              Severity: Minor
              Found in Application/Document/Generator/Service.php - About 1 hr to fix

                Method createDocumentSubjects has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createDocumentSubjects(
                        IFormInterface $Form,
                        TblDocument $tblDocument,
                        $Data
                    ) {
                Severity: Minor
                Found in Application/Document/Generator/Service.php - About 1 hr to fix

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

                      private function getCourses(TblPerson $tblPerson, TblDivision $tblDivision, $advancedCourses, $basicCourses)
                      {
                  
                          if (($tblDivisionSubjectList = Division::useService()->getDivisionSubjectByDivision($tblDivision))) {
                              foreach ($tblDivisionSubjectList as $tblDivisionSubjectItem) {
                  Severity: Minor
                  Found in Application/Document/Generator/Service.php - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (($tblPrepare = $item->getTblPrepareCertificate())
                                    && ($tblDivision = $tblPrepare->getServiceTblDivision())
                                    && ($tblLevel = $tblDivision->getTblLevel())
                                    && ($tblPrepare->getServiceTblGenerateCertificate())
                                    && ($tblCertificateType = $tblPrepare->getServiceTblGenerateCertificate()->getServiceTblCertificateType())
                    Severity: Major
                    Found in Application/Document/Generator/Service.php - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                                  if (($tblPrepare = $item->getTblPrepareCertificate())
                                      && ($tblDivision = $tblPrepare->getServiceTblDivision())
                                      && ($tblLevel = $tblDivision->getTblLevel())
                                      && ($tblPrepare->getServiceTblGenerateCertificate())
                                      && ($tblCertificateType = $tblPrepare->getServiceTblGenerateCertificate()->getServiceTblCertificateType())
                      Severity: Major
                      Found in Application/Document/Generator/Service.php - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                        if (($tblAppointedDateTask = $tblPrepare->getServiceTblAppointedDateTask())
                                            && $tblYear
                                            && ($tblPeriodList = $tblYear->getTblPeriodAll($tblLevel && $tblLevel->getName() == '12'))
                                            && ($tblPeriod = $tblAppointedDateTask->getServiceTblPeriodByDivision($tblDivision))
                                            && ($tblFirstPeriod = current($tblPeriodList))
                        Severity: Major
                        Found in Application/Document/Generator/Service.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                                  if ($tblPrepare->getServiceTblGenerateCertificate()
                                                      && ($tblCertificateType = $tblPrepare->getServiceTblGenerateCertificate()->getServiceTblCertificateType())
                                                      && ($tblCertificateType->getIdentifier() == 'HALF_YEAR' || $tblCertificateType->getIdentifier() == 'YEAR')
                                                      && ($tblPrepareStudent = Prepare::useService()->getPrepareStudentBy($tblPrepare,
                                                          $tblPerson))
                          Severity: Major
                          Found in Application/Document/Generator/Service.php - About 1 hr to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                            if ($value == 'nicht erteilt') {
                                                                $value = 'ne';
                                                            } elseif ($value == 'teilgenommen') {
                                                                $value = 't';
                                                            } elseif ($value == 'Keine Benotung') {
                            Severity: Major
                            Found in Application/Document/Generator/Service.php - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                              if (($tblDivisionSubjectList = Division::useService()->getDivisionSubjectAllByPersonAndYear($tblPerson, $tblYear))) {
                                                                  foreach ($tblDivisionSubjectList as $tblDivisionSubject) {
                                                                      if (($tblSubjectTemp = $tblDivisionSubject->getServiceTblSubject())
                                                                          && Subject::useService()->isProfile($tblSubjectTemp)
                                                                      ) {
                              Severity: Major
                              Found in Application/Document/Generator/Service.php - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                if (($tblDivisionSubjectList = Division::useService()->getDivisionSubjectAllByPersonAndYear($tblPerson, $tblYear))) {
                                                                    foreach ($tblDivisionSubjectList as $tblDivisionSubject) {
                                                                        if (($tblSubjectTemp = $tblDivisionSubject->getServiceTblSubject())
                                                                            && Subject::useService()->isOrientation($tblSubjectTemp)
                                                                        ) {
                                Severity: Major
                                Found in Application/Document/Generator/Service.php - About 45 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                                          if ($tblPrepare->getServiceTblGenerateCertificate()
                                                              && ($tblCertificateType = $tblPrepare->getServiceTblGenerateCertificate()->getServiceTblCertificateType())
                                                              && ($tblCertificateType->getIdentifier() == 'MID_TERM_COURSE')
                                                              && ($tblPrepareStudent = Prepare::useService()->getPrepareStudentBy($tblPrepare,
                                                                  $tblPerson))
                                  Severity: Major
                                  Found in Application/Document/Generator/Service.php - About 40 mins to fix

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

                                        public function getSchoolTypeListForStudentCard(TblPerson $tblPerson)
                                        {
                                    
                                            $list = array();
                                            if (($tblDivisionStudentList = Division::useService()->getDivisionStudentAllByPerson($tblPerson))) {
                                    Severity: Minor
                                    Found in Application/Document/Generator/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

                                    There are no issues that match your filters.

                                    Category
                                    Status