DerDu/SPHERE-Framework

View on GitHub
Application/Education/Certificate/PrintCertificate/Frontend.php

Summary

Maintainability
F
1 wk
Test Coverage

Function frontendPrintCertificateDivisionTeacher has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
Open

    public function frontendPrintCertificateDivisionTeacher()
    {

        $Stage = new Stage('Zeugnis', 'Übersicht (nicht gedruckte Zeugnisse)');

Severity: Minor
Found in Application/Education/Certificate/PrintCertificate/Frontend.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

Function frontendPrintCertificate has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
Open

    public function frontendPrintCertificate()
    {

        $Stage = new Stage('Zeugnis', 'Übersicht (nicht gedruckte Zeugnisse)');
        $Stage->addButton(new Standard('Historie Personen', '/Education/Certificate/PrintCertificate/History', null, array(),
Severity: Minor
Found in Application/Education/Certificate/PrintCertificate/Frontend.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

File Frontend.php has 733 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Created by PhpStorm.
 * User: Kauschke
 * Date: 26.07.2016
Severity: Major
Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 1 day to fix

    Function frontendConfirmPrintCertificate has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        public function frontendConfirmPrintCertificate(
            $PrepareId = null,
            $DivisionId = null,
            $IsLeave = false,
            $Route = 'All'
    Severity: Minor
    Found in Application/Education/Certificate/PrintCertificate/Frontend.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 frontendPrintCertificate has 165 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function frontendPrintCertificate()
        {
    
            $Stage = new Stage('Zeugnis', 'Übersicht (nicht gedruckte Zeugnisse)');
            $Stage->addButton(new Standard('Historie Personen', '/Education/Certificate/PrintCertificate/History', null, array(),
    Severity: Major
    Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 6 hrs to fix

      Method frontendConfirmPrintCertificate has 133 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function frontendConfirmPrintCertificate(
              $PrepareId = null,
              $DivisionId = null,
              $IsLeave = false,
              $Route = 'All'
      Severity: Major
      Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 5 hrs to fix

        Method frontendPrintCertificateDivisionTeacher has 126 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function frontendPrintCertificateDivisionTeacher()
            {
        
                $Stage = new Stage('Zeugnis', 'Übersicht (nicht gedruckte Zeugnisse)');
        
        
        Severity: Major
        Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 5 hrs to fix

          Method frontendPrintCertificateHistoryPerson has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function frontendPrintCertificateHistoryPerson($PersonId = null)
              {
          
                  $Stage = new Stage('Zeugnis', 'Auswahl');
                  $Stage->addButton(new Standard('Zurück', '/Education/Certificate/PrintCertificate/History', new ChevronLeft()));
          Severity: Major
          Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 2 hrs to fix

            Function frontendPrintCertificateHistory has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                public function frontendPrintCertificateHistory()
                {
            
                    $Stage = new Stage('Zeugnis', 'Person auswählen');
                    $Stage->addButton(new Standard(
            Severity: Minor
            Found in Application/Education/Certificate/PrintCertificate/Frontend.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 frontendPrintCertificateHistorySelectedDivision has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function frontendPrintCertificateHistorySelectedDivision($DivisionId = null)
                {
            
                    $Stage = new Stage('Zeugnis', 'Auswahl');
                    $Stage->addButton(new Standard('Zurück', '/Education/Certificate/PrintCertificate/History/Division', new ChevronLeft()));
            Severity: Major
            Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 2 hrs to fix

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

                  public function frontendPrintCertificateHistory()
                  {
              
                      $Stage = new Stage('Zeugnis', 'Person auswählen');
                      $Stage->addButton(new Standard(
              Severity: Major
              Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 2 hrs to fix

                Function frontendPrintCertificateHistoryPerson has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function frontendPrintCertificateHistoryPerson($PersonId = null)
                    {
                
                        $Stage = new Stage('Zeugnis', 'Auswahl');
                        $Stage->addButton(new Standard('Zurück', '/Education/Certificate/PrintCertificate/History', new ChevronLeft()));
                Severity: Minor
                Found in Application/Education/Certificate/PrintCertificate/Frontend.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 frontendPrintCertificateHistoryDivision has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function frontendPrintCertificateHistoryDivision()
                    {
                
                        $Stage = new Stage('Zeugnis', 'Klasse auswählen');
                        $Stage->addButton(new Standard(
                Severity: Minor
                Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 1 hr to fix

                  Function frontendPrintCertificateHistorySelectedDivision has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function frontendPrintCertificateHistorySelectedDivision($DivisionId = null)
                      {
                  
                          $Stage = new Stage('Zeugnis', 'Auswahl');
                          $Stage->addButton(new Standard('Zurück', '/Education/Certificate/PrintCertificate/History/Division', new ChevronLeft()));
                  Severity: Minor
                  Found in Application/Education/Certificate/PrintCertificate/Frontend.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

                  Consider simplifying this complex logical expression.
                  Open

                                                      if (($tblPerson = $tblPrepareStudent->getServiceTblPerson())
                                                          && ($tblPrepare = $tblPrepareStudent->getTblPrepareCertificate())
                                                          && $tblPrepareStudent->getServiceTblCertificate()
                                                          && !$tblPrepareStudent->isPrinted()
                                                          && ($tblDivisionItem = $tblPrepare->getServiceTblDivision())
                  Severity: Major
                  Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (($tblDivisionItem = $tblPrepareCertificate->getServiceTblDivision())
                                                        && isset($divisionList[$tblDivisionItem->getId()])
                                                    ) {
                                                        if (($tblPrepareStudentList = Prepare::useService()->getPrepareStudentAllByPrepare($tblPrepareCertificate))) {
                                                            foreach ($tblPrepareStudentList as $tblPrepareStudent) {
                    Severity: Major
                    Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                          if (($tblPerson = $tblPrepareStudent->getServiceTblPerson())
                                                              && ($tblPrepare = $tblPrepareStudent->getTblPrepareCertificate())
                                                              && $tblPrepareStudent->getServiceTblCertificate()
                                                              && !$tblPrepareStudent->isPrinted()
                                                              && ($tblDivisionItem = $tblPrepare->getServiceTblDivision())
                      Severity: Major
                      Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 45 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                            if (($tblPerson = $tblPrepareStudent->getServiceTblPerson())
                                                && ($tblPrepare = $tblPrepareStudent->getTblPrepareCertificate())
                                                && $tblPrepareStudent->getServiceTblCertificate()
                                                && ($tblDivisionItem = $tblPrepare->getServiceTblDivision())
                                                && ($tblDivisionStudent = Division::useService()->getDivisionStudentByDivisionAndPerson($tblDivisionItem, $tblPerson))
                        Severity: Major
                        Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                                                      if (($tblPerson = $tblPrepareStudent->getServiceTblPerson())
                                                                          && ($tblPrepare = $tblPrepareStudent->getTblPrepareCertificate())
                                                                          && $tblPrepareStudent->getServiceTblCertificate()
                                                                          && !$tblPrepareStudent->isPrinted()
                                                                          && ($tblDivisionStudent = Division::useService()->getDivisionStudentByDivisionAndPerson($tblDivisionItem, $tblPerson))
                          Severity: Major
                          Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                            if (($tblPerson = $tblPrepareStudent->getServiceTblPerson())
                                                && ($tblPrepare = $tblPrepareStudent->getTblPrepareCertificate())
                                                && $tblPrepareStudent->getServiceTblCertificate()
                                                && ($tblDivisionItem = $tblPrepare->getServiceTblDivision())
                                                && ($tblDivisionStudent = Division::useService()->getDivisionStudentByDivisionAndPerson($tblDivisionItem, $tblPerson))
                            Severity: Major
                            Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 40 mins to fix

                              Function frontendPrintCertificateHistoryDivision has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function frontendPrintCertificateHistoryDivision()
                                  {
                              
                                      $Stage = new Stage('Zeugnis', 'Klasse auswählen');
                                      $Stage->addButton(new Standard(
                              Severity: Minor
                              Found in Application/Education/Certificate/PrintCertificate/Frontend.php - About 25 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

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

                                      $Stage->setContent(
                                          new Layout(array(
                                              new LayoutGroup(array(
                                                  new LayoutRow(array(
                                                      new LayoutColumn(array(
                              Application/Education/Certificate/PrintCertificate/Frontend.php on lines 196..230

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

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

                                      $Stage->setContent(
                                          new Layout(array(
                                              new LayoutGroup(array(
                                                  new LayoutRow(array(
                                                      new LayoutColumn(array(
                              Application/Education/Certificate/PrintCertificate/Frontend.php on lines 340..374

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

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

                                          if (($tblLeaveStudentList = Prepare::useService()->getLeaveStudentAllBy(false, false))) {
                                              foreach ($tblLeaveStudentList as $tblLeaveStudent) {
                                                  if (($tblDivision = $tblLeaveStudent->getServiceTblDivision())
                                                      && !isset($leaveDivisionList[$tblDivision->getId()])
                                                  ) {
                              Application/Education/Certificate/PrintCertificate/Frontend.php on lines 84..100

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

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

                                      if (($tblLeaveStudentList = Prepare::useService()->getLeaveStudentAllBy(true, false))) {
                                          foreach ($tblLeaveStudentList as $tblLeaveStudent) {
                                              if (($tblDivision = $tblLeaveStudent->getServiceTblDivision())
                                                  && !isset($leaveDivisionList[$tblDivision->getId()])
                                              ) {
                              Application/Education/Certificate/PrintCertificate/Frontend.php on lines 135..151

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

                              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

                                          if ($tblPrepareList = Prepare::useService()->getPrepareAllByDivision($tblDivision)){
                                              foreach ($tblPrepareList as $tblPrepare){
                                                  if (Prepare::useService()->isPreparePrinted($tblPrepare)) {
                                                      $dataList[] = array(
                                                          'Year' => $tblDivision->getServiceTblYear() ? $tblDivision->getServiceTblYear()->getDisplayName() : '',
                              Application/Education/Certificate/PrintCertificate/Frontend.php on lines 718..736

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

                              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

                                      if ($tblDivisionList) {
                                          /** @var TblDivision $tblDivision */
                                          foreach ($tblDivisionList as $tblDivision) {
                                              if (Prepare::useService()->getPrepareAllByDivision($tblDivision)) {
                                                  $divisionTable[] = array(
                              Application/Education/Certificate/PrintCertificate/Frontend.php on lines 779..797

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

                              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