DerDu/SPHERE-Framework

View on GitHub
Application/Api/Education/Certificate/Generator/Repository/ESRL/EsrlStyle.php

Summary

Maintainability
F
1 wk
Test Coverage

File EsrlStyle.php has 487 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace SPHERE\Application\Api\Education\Certificate\Generator\Repository\ESRL;

use SPHERE\Application\Api\Education\Certificate\Generator\Certificate;
use SPHERE\Application\Education\Certificate\Generator\Generator;

    Function getESRLSubjectLanes has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getESRLSubjectLanes($personId, $Height = '175px')
        {
    
            $SubjectSlice = (new Slice());
    
    

    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 getESRLTeacher has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getESRLTeacher($personId, $isExtended = true, $MarginTop = '25px')
        {
            $SignSlice = (new Slice());
            if ($isExtended) {
                $SignSlice->addSection((new Section())

      Function getESRLHeadGrade has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getESRLHeadGrade($personId)
          {
      
              $GradeSlice = (new Slice());
      
      

      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 getESRLSubjectLanes has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getESRLSubjectLanes($personId, $Height = '175px')
          {
      
              $SubjectSlice = (new Slice());
      
      

        Method getESRLHeadGrade has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getESRLHeadGrade($personId)
            {
        
                $GradeSlice = (new Slice());
        
        

          Method getESRLDivisionAndYear has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getESRLDivisionAndYear($personId)
              {
          
                  $Section = (new Section());
                  $Section->addElementColumn((new Element())

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

                public function getESRLHead($PictureHeight = '135px')
                {
            
                    $PictureSection = (new Section())
                        ->addElementColumn((new Element\Image('Common/Style/Resource/Logo/ESRL_Zeugnis_Logo.jpg',

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

                  protected function getESRLTeacher($personId, $isExtended = true, $MarginTop = '25px')
                  {
                      $SignSlice = (new Slice());
                      if ($isExtended) {
                          $SignSlice->addSection((new Section())
              Application/Api/Education/Certificate/Generator/Certificate.php on lines 1331..1455

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

              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 7 locations. Consider refactoring.
              Open

                          foreach ($tblCertificateSubjectAll as $tblCertificateSubject) {
                              $tblSubject = $tblCertificateSubject->getServiceTblSubject();
                              if ($tblSubject) {
                                  // Grade Exists? => Add Subject to Certificate
                                  if (isset($tblGradeList['Data'][$tblSubject->getAcronym()])) {
              Application/Api/Education/Certificate/Generator/Certificate.php on lines 552..571
              Application/Api/Education/Certificate/Generator/Certificate.php on lines 950..970
              Application/Api/Education/Certificate/Generator/Certificate.php on lines 2904..2923
              Application/Api/Education/Certificate/Generator/Repository/CMS/CmsStyle.php on lines 314..333
              Application/Api/Education/Certificate/Generator/Repository/ESS/EssStyle.php on lines 131..150
              Application/Api/Education/Certificate/Generator/Repository/EZSH/EzshStyle.php on lines 324..343

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

              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

                              foreach ($GradeList as $Lane => $Grade) {
              
                                  if ($Lane > 1) {
                                      $GradeSection->addElementColumn((new Element())
                                          , '4%');
              Application/Api/Education/Certificate/Generator/Repository/ESRL/EsrlStyle.php on lines 296..321

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

              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

                              foreach ($SubjectList as $Lane => $Subject) {
              
                                  if ($Lane > 1) {
                                      $SubjectSection->addElementColumn((new Element())
                                          , '4%');
              Application/Api/Education/Certificate/Generator/Repository/ESRL/EsrlStyle.php on lines 187..210

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

              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