DerDu/SPHERE-Framework

View on GitHub
Application/Education/Lesson/Subject/Service.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php
namespace SPHERE\Application\Education\Lesson\Subject;

use SPHERE\Application\Education\Lesson\Division\Division;
use SPHERE\Application\Education\Lesson\Division\Service\Entity\TblDivision;
Severity: Major
Found in Application/Education/Lesson/Subject/Service.php - About 1 day to fix

    Service has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Service extends AbstractService
    {
    
        /**
         * @param bool $doSimulation
    Severity: Minor
    Found in Application/Education/Lesson/Subject/Service.php - About 7 hrs to fix

      Function removePersonListFromSubject has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          private function removePersonListFromSubject($DataRemovePerson, $SubjectGroup, $Group)
          {
      
              foreach ($DataRemovePerson as $personId => $value) {
                  $tblPerson = Person::useService()->getPersonById($personId);
      Severity: Minor
      Found in Application/Education/Lesson/Subject/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 filterPersonListByDivision has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function filterPersonListByDivision(
              $tblPersonList,
              TblDivision $tblDivision = null
          ) {
      
      
      Severity: Minor
      Found in Application/Education/Lesson/Subject/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 addPersonListFromSubject has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          private function addPersonListFromSubject($DataAddPerson, TblSubject $tblSubject, $SubjectGroup, $Group)
          {
      
              foreach ($DataAddPerson as $personId => $value) {
                  $tblPerson = Person::useService()->getPersonById($personId);
      Severity: Minor
      Found in Application/Education/Lesson/Subject/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

      Function changeSubject has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function changeSubject(IFormInterface $Form, $Subject, $Id)
          {
      
              /**
               * Skip to Frontend
      Severity: Minor
      Found in Application/Education/Lesson/Subject/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

      Function changeCategory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function changeCategory(IFormInterface $Form, $Category, $Id)
          {
      
              /**
               * Skip to Frontend
      Severity: Minor
      Found in Application/Education/Lesson/Subject/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 changeSubject has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function changeSubject(IFormInterface $Form, $Subject, $Id)
          {
      
              /**
               * Skip to Frontend
      Severity: Minor
      Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

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

            public function changeCategory(IFormInterface $Form, $Category, $Id)
            {
        
                /**
                 * Skip to Frontend
        Severity: Minor
        Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

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

              public function createSubject(
                  IFormInterface $Form,
                  $Subject
              ) {
          
          
          Severity: Minor
          Found in Application/Education/Lesson/Subject/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 changeGroupCategory has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function changeGroupCategory(
                  IFormInterface $Form,
                  TblGroup $tblGroup,
                  $Category
              ) {
          Severity: Minor
          Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

            Method changeCategorySubject has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function changeCategorySubject(
                    IFormInterface $Form,
                    TblCategory $tblCategory,
                    $Subject
                ) {
            Severity: Minor
            Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

              Method createSubject has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createSubject(
                      IFormInterface $Form,
                      $Subject
                  ) {
              
              
              Severity: Minor
              Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

                Function destroyCategory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function destroyCategory(TblCategory $tblCategory)
                    {
                
                        if (null === $tblCategory) {
                            return '';
                Severity: Minor
                Found in Application/Education/Lesson/Subject/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

                Function createCategory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createCategory(
                        IFormInterface $Form,
                        $Category
                    ) {
                
                
                Severity: Minor
                Found in Application/Education/Lesson/Subject/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 createCategory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function createCategory(
                        IFormInterface $Form,
                        $Category
                    ) {
                
                
                Severity: Minor
                Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

                  Method addPersonsToSubject has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          IFormInterface $Form,
                          $Id,
                          $SubjectGroup,
                          $Group,
                          TblSubject $tblSubject,
                  Severity: Major
                  Found in Application/Education/Lesson/Subject/Service.php - About 1 hr to fix

                    Function changeCategorySubject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function changeCategorySubject(
                            IFormInterface $Form,
                            TblCategory $tblCategory,
                            $Subject
                        ) {
                    Severity: Minor
                    Found in Application/Education/Lesson/Subject/Service.php - About 55 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

                    Function changeGroupCategory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function changeGroupCategory(
                            IFormInterface $Form,
                            TblGroup $tblGroup,
                            $Category
                        ) {
                    Severity: Minor
                    Found in Application/Education/Lesson/Subject/Service.php - About 55 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

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

                        public function isElective(TblSubject $tblSubject)
                        {
                            if (($tblSubjectElectiveAll = $this->getSubjectElectiveAll())) {
                                foreach ($tblSubjectElectiveAll as $tblSubjectElective) {
                                    if ($tblSubjectElective && $tblSubjectElective->getId() == $tblSubject->getId()) {
                    Severity: Minor
                    Found in Application/Education/Lesson/Subject/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

                    Avoid too many return statements within this method.
                    Open

                            return $Form;
                    Severity: Major
                    Found in Application/Education/Lesson/Subject/Service.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return $Form;
                      Severity: Major
                      Found in Application/Education/Lesson/Subject/Service.php - About 30 mins to fix

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

                            public function getSubjectReligionAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblGroup = $this->getGroupByIdentifier('STANDARD');
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function getSubjectElectiveAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblCategory = $this->getGroupByIdentifier('ELECTIVE');
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function isOrientation(TblSubject $tblSubject)
                            {
                                if (($tblSubjectOrientationAll = $this->getSubjectOrientationAll())) {
                                    foreach ($tblSubjectOrientationAll as $tblSubjectOrientation) {
                                        if ($tblSubjectOrientation->getId() == $tblSubject->getId()) {
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function getSubjectAdvancedAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblCategory = $this->getGroupByIdentifier('ADVANCED');
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function getSubjectProfileAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblGroup = $this->getGroupByIdentifier('STANDARD');
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function getSubjectOrientationAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblCategory = $this->getGroupByIdentifier('ORIENTATION');
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function getSubjectForeignLanguageAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblGroup = $this->getGroupByIdentifier('STANDARD');
                        Severity: Minor
                        Found in Application/Education/Lesson/Subject/Service.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

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

                            public function getSubjectAdvancedAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblCategory = $this->getGroupByIdentifier('ADVANCED');
                        Severity: Major
                        Found in Application/Education/Lesson/Subject/Service.php and 1 other location - About 2 hrs to fix
                        Application/Education/Lesson/Subject/Service.php on lines 195..214

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

                        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 getSubjectElectiveAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblCategory = $this->getGroupByIdentifier('ELECTIVE');
                        Severity: Major
                        Found in Application/Education/Lesson/Subject/Service.php and 1 other location - About 2 hrs to fix
                        Application/Education/Lesson/Subject/Service.php on lines 100..121

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

                        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 getSubjectForeignLanguageAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblGroup = $this->getGroupByIdentifier('STANDARD');
                        Severity: Major
                        Found in Application/Education/Lesson/Subject/Service.php and 1 other location - About 1 hr to fix
                        Application/Education/Lesson/Subject/Service.php on lines 126..144

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

                        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 getSubjectProfileAll()
                            {
                        
                                $tblSubjectList = array();
                                $tblGroup = $this->getGroupByIdentifier('STANDARD');
                        Severity: Major
                        Found in Application/Education/Lesson/Subject/Service.php and 1 other location - About 1 hr to fix
                        Application/Education/Lesson/Subject/Service.php on lines 172..190

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

                        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 (!$Error) {
                        
                                    if ((new Data($this->getBinding()))->createCategory(
                                        $Category['Name'], $Category['Description']
                                    )
                        Severity: Major
                        Found in Application/Education/Lesson/Subject/Service.php and 1 other location - About 1 hr to fix
                        Application/Education/Lesson/Term/Service.php on lines 215..223

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

                        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 destroySubject(TblSubject $tblSubject)
                            {
                        
                                if (null === $tblSubject) {
                                    return '';
                        Severity: Major
                        Found in Application/Education/Lesson/Subject/Service.php and 1 other location - About 1 hr to fix
                        Application/Education/Lesson/Term/Service.php on lines 599..613

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

                        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