DerDu/SPHERE-Framework

View on GitHub
Application/Api/Education/Certificate/Generator/Repository/CMS/CmsStyle.php

Summary

Maintainability
F
2 wks
Test Coverage

File CmsStyle.php has 897 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace SPHERE\Application\Api\Education\Certificate\Generator\Repository\CMS;

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

    Method getCMSOrientationStandard has 265 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getCMSOrientationStandard($personId, $TextSize = '14px', $IsGradeUnderlined = false)
        {
    
            $tblPerson = Person::useService()->getPersonById($personId);
    
    

      Function getCMSSubjectLanes has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getCMSSubjectLanes($personId, $IsHeadline = true, $Height = '270px')
          {
      
              $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 getCMSTeacher has 118 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

            public function getCMSSubjectLanes($personId, $IsHeadline = true, $Height = '270px')
            {
        
                $SubjectSlice = (new Slice());
        
        

          Function getCMSOrientationStandard has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getCMSOrientationStandard($personId, $TextSize = '14px', $IsGradeUnderlined = false)
              {
          
                  $tblPerson = Person::useService()->getPersonById($personId);
          
          

          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 getCMSHeadGrade has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function getCMSHeadGrade($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 getCMSHeadGrade has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

                public function getCMSHead($PictureHeight = 100)
                {
            
                    if ($this->isSample()) {
                        $Header = (new Slice)->addSection((new Section())

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

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

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

                    public function getCMSOrientationStandard($personId, $TextSize = '14px', $IsGradeUnderlined = false)
                    {
                
                        $tblPerson = Person::useService()->getPersonById($personId);
                
                
                Application/Api/Education/Certificate/Generator/Certificate.php on lines 2181..2480

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

                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

                                    $SubjectSection->addElementColumn((new Element())
                                        ->setContent('{% if(Content.P'.$personId.'.Grade.Data["'.$Subject['SubjectAcronym'].'"] is not empty) %}
                                                             {{ Content.P'.$personId.'.Grade.Data["'.$Subject['SubjectAcronym'].'"] }}
                                                         {% else %}
                                                             &ndash;
                Application/Api/Education/Certificate/Generator/Repository/EZSH/EzshStyle.php on lines 510..537

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

                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/ESRL/EsrlStyle.php on lines 241..260
                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

                    public function getCMSSecondRemark($personId, $Height = '100px', $IsHeadLine = false)
                    {
                        $SectionList = array();
                        if ($IsHeadLine) {
                            $Section = new Section();
                Application/Api/Education/Certificate/Generator/Repository/CMS/CmsStyle.php on lines 756..781

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

                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

                    public function getCMSRemark($personId, $Height = '100px', $IsHeadLine = false)
                    {
                        $SectionList = array();
                        if ($IsHeadLine) {
                            $Section = new Section();
                Application/Api/Education/Certificate/Generator/Repository/CMS/CmsStyle.php on lines 790..815

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

                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