DerDu/SPHERE-Framework

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

Summary

Maintainability
F
5 days
Test Coverage

File Data.php has 485 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

use SPHERE\Application\Education\Lesson\Subject\Service\Entity\TblCategory;
use SPHERE\Application\Education\Lesson\Subject\Service\Entity\TblCategorySubject;
Severity: Minor
Found in Application/Education/Lesson/Subject/Service/Data.php - About 7 hrs to fix

    Method setupDatabaseContent has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setupDatabaseContent()
        {
    
            $hasSubjects = $this->getSubjectAll();
    
    
    Severity: Major
    Found in Application/Education/Lesson/Subject/Service/Data.php - About 4 hrs to fix

      Data has 32 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Data extends AbstractData
      {
      
          public function setupDatabaseContent()
          {
      Severity: Minor
      Found in Application/Education/Lesson/Subject/Service/Data.php - About 4 hrs to fix

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

            public function getSubjectAllHavingNoCategory()
            {
        
                $Exclude = $this->getConnection()->getEntityManager()->getQueryBuilder()
                    ->select('NM.tblSubject')
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 1 other location - About 4 hrs to fix
        Application/Education/Lesson/Subject/Service/Data.php on lines 696..720

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

        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 getCategoryAllHavingNoGroup()
            {
        
                $Exclude = $this->getConnection()->getEntityManager()->getQueryBuilder()
                    ->select('NM.tblCategory')
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 1 other location - About 4 hrs to fix
        Application/Education/Lesson/Subject/Service/Data.php on lines 658..682

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

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

            public function addGroupCategory(TblGroup $tblGroup, TblCategory $tblCategory)
            {
        
                $Manager = $this->getConnection()->getEntityManager();
                $Entity = $Manager->getEntity('TblGroupCategory')
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 22 other locations - About 3 hrs to fix
        Application/Billing/Bookkeeping/Basket/Service/Data.php on lines 459..480
        Application/Billing/Inventory/Document/Service/Data.php on lines 166..184
        Application/Billing/Inventory/Item/Service/Data.php on lines 569..593
        Application/Corporation/Group/Service/Data.php on lines 286..303
        Application/Education/Certificate/Generator/Service/Data.php on lines 4382..4404
        Application/Education/Graduation/Gradebook/ScoreRule/Data.php on lines 496..519
        Application/Education/Graduation/Gradebook/ScoreRule/Data.php on lines 595..618
        Application/Education/Lesson/Division/Service/Data.php on lines 1095..1112
        Application/Education/Lesson/Division/Service/Data.php on lines 1120..1138
        Application/Education/Lesson/Subject/Service/Data.php on lines 272..289
        Application/Education/Lesson/Term/Service/Data.php on lines 234..251
        Application/People/Group/Service/Data.php on lines 365..382
        Application/People/Meta/Student/Service/Data/Agreement.php on lines 182..205
        Application/People/Meta/Student/Service/Data/Integration.php on lines 321..344
        Application/People/Meta/Student/Service/Data/Liberation.php on lines 165..188
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 285..302
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 328..345
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 371..388
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 294..311
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 319..336
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 1132..1149
        Application/Reporting/SerialLetter/Service/Data.php on lines 472..493

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

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

            public function addCategorySubject(TblCategory $tblCategory, TblSubject $tblSubject)
            {
        
                $Manager = $this->getConnection()->getEntityManager();
                $Entity = $Manager->getEntity('TblCategorySubject')
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 22 other locations - About 3 hrs to fix
        Application/Billing/Bookkeeping/Basket/Service/Data.php on lines 459..480
        Application/Billing/Inventory/Document/Service/Data.php on lines 166..184
        Application/Billing/Inventory/Item/Service/Data.php on lines 569..593
        Application/Corporation/Group/Service/Data.php on lines 286..303
        Application/Education/Certificate/Generator/Service/Data.php on lines 4382..4404
        Application/Education/Graduation/Gradebook/ScoreRule/Data.php on lines 496..519
        Application/Education/Graduation/Gradebook/ScoreRule/Data.php on lines 595..618
        Application/Education/Lesson/Division/Service/Data.php on lines 1095..1112
        Application/Education/Lesson/Division/Service/Data.php on lines 1120..1138
        Application/Education/Lesson/Subject/Service/Data.php on lines 221..238
        Application/Education/Lesson/Term/Service/Data.php on lines 234..251
        Application/People/Group/Service/Data.php on lines 365..382
        Application/People/Meta/Student/Service/Data/Agreement.php on lines 182..205
        Application/People/Meta/Student/Service/Data/Integration.php on lines 321..344
        Application/People/Meta/Student/Service/Data/Liberation.php on lines 165..188
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 285..302
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 328..345
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 371..388
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 294..311
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 319..336
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 1132..1149
        Application/Reporting/SerialLetter/Service/Data.php on lines 472..493

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

        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 updateCategory(TblCategory $tblCategory, $Name, $Description = '')
            {
        
                $Manager = $this->getConnection()->getEntityManager();
        
        
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 1 other location - About 2 hrs to fix
        Application/Education/Lesson/Division/Service/Data.php on lines 1516..1534

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

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

            public function removeGroupCategory(TblGroup $tblGroup, TblCategory $tblCategory)
            {
        
                $Manager = $this->getConnection()->getEntityManager();
                /** @var TblGroupCategory $Entity */
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 10 other locations - About 2 hrs to fix
        Application/Corporation/Group/Service/Data.php on lines 311..327
        Application/Education/Lesson/Subject/Service/Data.php on lines 484..500
        Application/Education/Lesson/Term/Service/Data.php on lines 259..275
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 396..412
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 420..436
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 444..460
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 416..432
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 440..456
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 1157..1173
        Application/Reporting/SerialLetter/Service/Data.php on lines 928..946

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

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

            public function removeCategorySubject(TblCategory $tblCategory, TblSubject $tblSubject)
            {
        
                $Manager = $this->getConnection()->getEntityManager();
                /** @var TblCategorySubject $Entity */
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 10 other locations - About 2 hrs to fix
        Application/Corporation/Group/Service/Data.php on lines 311..327
        Application/Education/Lesson/Subject/Service/Data.php on lines 460..476
        Application/Education/Lesson/Term/Service/Data.php on lines 259..275
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 396..412
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 420..436
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 444..460
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 416..432
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 440..456
        Application/Platform/Gatekeeper/Authorization/Account/Service/Data.php on lines 1157..1173
        Application/Reporting/SerialLetter/Service/Data.php on lines 928..946

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

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

            public function getGroupAllByCategory(TblCategory $tblCategory)
            {
        
                /** @var TblGroupCategory[] $EntityList */
                $EntityList = $this->getCachedEntityListBy(__METHOD__, $this->getConnection()->getEntityManager(),
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 2 other locations - About 1 hr to fix
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 576..589
        Application/Platform/Gatekeeper/Authorization/Access/Service/Data.php on lines 597..612

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

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

            public function destroyCategory(TblCategory $tblCategory)
            {
        
                $Manager = $this->getConnection()->getEntityManager();
        
        
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 15 other locations - About 1 hr to fix
        Application/Billing/Bookkeeping/Basket/Service/Data.php on lines 766..784
        Application/Billing/Bookkeeping/Basket/Service/Data.php on lines 819..833
        Application/Billing/Inventory/Item/Service/Data.php on lines 681..699
        Application/Education/Certificate/Generator/Service/Data.php on lines 4453..4466
        Application/Education/Certificate/Generator/Service/Data.php on lines 4473..4486
        Application/Education/Certificate/Generator/Service/Data.php on lines 4631..4644
        Application/Education/Certificate/Generator/Service/Data.php on lines 4651..4664
        Application/Education/Lesson/Division/Service/Data.php on lines 1601..1614
        Application/Education/Lesson/Division/Service/Data.php on lines 1621..1634
        Application/Education/Lesson/Division/Service/Data.php on lines 2411..2426
        Application/Education/Lesson/Subject/Service/Data.php on lines 399..413
        Application/Education/Lesson/Term/Service/Data.php on lines 191..205
        Application/Education/Lesson/Term/Service/Data.php on lines 212..226
        Application/Education/Lesson/Term/Service/Data.php on lines 871..886
        Application/Setting/Consumer/Service/Data.php on lines 556..569

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

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

            public function destroySubject(TblSubject $tblSubject)
            {
        
                $Manager = $this->getConnection()->getEntityManager();
        
        
        Severity: Major
        Found in Application/Education/Lesson/Subject/Service/Data.php and 15 other locations - About 1 hr to fix
        Application/Billing/Bookkeeping/Basket/Service/Data.php on lines 766..784
        Application/Billing/Bookkeeping/Basket/Service/Data.php on lines 819..833
        Application/Billing/Inventory/Item/Service/Data.php on lines 681..699
        Application/Education/Certificate/Generator/Service/Data.php on lines 4453..4466
        Application/Education/Certificate/Generator/Service/Data.php on lines 4473..4486
        Application/Education/Certificate/Generator/Service/Data.php on lines 4631..4644
        Application/Education/Certificate/Generator/Service/Data.php on lines 4651..4664
        Application/Education/Lesson/Division/Service/Data.php on lines 1601..1614
        Application/Education/Lesson/Division/Service/Data.php on lines 1621..1634
        Application/Education/Lesson/Division/Service/Data.php on lines 2411..2426
        Application/Education/Lesson/Subject/Service/Data.php on lines 420..434
        Application/Education/Lesson/Term/Service/Data.php on lines 191..205
        Application/Education/Lesson/Term/Service/Data.php on lines 212..226
        Application/Education/Lesson/Term/Service/Data.php on lines 871..886
        Application/Setting/Consumer/Service/Data.php on lines 556..569

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

        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