crocodic-studio/crudbooster

View on GitHub
src/controllers/CBController.php

Summary

Maintainability
F
3 wks
Test Coverage

File CBController.php has 1424 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace crocodicstudio\crudbooster\controllers;

error_reporting(E_ALL ^ E_NOTICE);


Severity: Major
Found in src/controllers/CBController.php - About 3 days to fix

    Function getIndex has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getIndex()
        {
            $this->cbLoader();
    
            $module = CRUDBooster::getCurrentModule();
    Severity: Minor
    Found in src/controllers/CBController.php - About 3 days 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 getIndex has 346 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getIndex()
        {
            $this->cbLoader();
    
            $module = CRUDBooster::getCurrentModule();
    Severity: Major
    Found in src/controllers/CBController.php - About 1 day to fix

      Function input_assignment has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
      Open

          public function input_assignment($id = null)
          {
      
              $hide_form = (request('hide_form')) ? unserialize(request('hide_form')) : [];
      
      
      Severity: Minor
      Found in src/controllers/CBController.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 validation has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
      Open

          public function validation($id = null)
          {
      
              $request_all = Request::all();
              $array_input = [];
      Severity: Minor
      Found in src/controllers/CBController.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 postEditSave has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
      Open

          public function postEditSave($id)
          {
              $this->cbLoader();
              $row = DB::table($this->table)->where($this->primary_key, $id)->first();
      
      
      Severity: Minor
      Found in src/controllers/CBController.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 postAddSave has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

          public function postAddSave()
          {
              $this->cbLoader();
              if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                  CRUDBooster::insertLog(cbLang('log_try_add_save', [
      Severity: Minor
      Found in src/controllers/CBController.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 postDoImportChunk has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

          public function postDoImportChunk()
          {
              $this->cbLoader();
              $file_md5 = md5(request('file'));
      
      
      Severity: Minor
      Found in src/controllers/CBController.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 getFindData has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getFindData()
          {
              $q = request('q');
              $id = request('id');
              $limit = request('limit') ?: 10;
      Severity: Minor
      Found in src/controllers/CBController.php - About 4 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

      CBController has 36 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class CBController extends Controller
      {
          public $data_inputan;
      
          public $columns_table;
      Severity: Minor
      Found in src/controllers/CBController.php - About 4 hrs to fix

        Method validation has 108 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function validation($id = null)
            {
        
                $request_all = Request::all();
                $array_input = [];
        Severity: Major
        Found in src/controllers/CBController.php - About 4 hrs to fix

          Method postEditSave has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function postEditSave($id)
              {
                  $this->cbLoader();
                  $row = DB::table($this->table)->where($this->primary_key, $id)->first();
          
          
          Severity: Major
          Found in src/controllers/CBController.php - About 4 hrs to fix

            Method input_assignment has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function input_assignment($id = null)
                {
            
                    $hide_form = (request('hide_form')) ? unserialize(request('hide_form')) : [];
            
            
            Severity: Major
            Found in src/controllers/CBController.php - About 3 hrs to fix

              Method postAddSave has 98 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function postAddSave()
                  {
                      $this->cbLoader();
                      if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                          CRUDBooster::insertLog(cbLang('log_try_add_save', [
              Severity: Major
              Found in src/controllers/CBController.php - About 3 hrs to fix

                Method postDoImportChunk has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function postDoImportChunk()
                    {
                        $this->cbLoader();
                        $file_md5 = md5(request('file'));
                
                
                Severity: Major
                Found in src/controllers/CBController.php - About 3 hrs to fix

                  Method getFindData has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getFindData()
                      {
                          $q = request('q');
                          $id = request('id');
                          $limit = request('limit') ?: 10;
                  Severity: Major
                  Found in src/controllers/CBController.php - About 3 hrs to fix

                    Method cbLoader has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function cbLoader()
                        {
                            $this->cbInit();
                    
                            $this->checkHideForm();
                    Severity: Major
                    Found in src/controllers/CBController.php - About 2 hrs to fix

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

                          public function postActionSelected()
                          {
                              $this->cbLoader();
                              $id_selected = Request::input('checkbox');
                              $button_name = Request::input('button_name');
                      Severity: Minor
                      Found in src/controllers/CBController.php - About 1 hr to fix

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

                            public function getImportData()
                            {
                                $this->cbLoader();
                                $data['page_menu'] = Route::getCurrentRoute()->getActionName();
                                $data['page_title'] = 'Import Data';
                        Severity: Minor
                        Found in src/controllers/CBController.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 getModalData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getModalData()
                            {
                                $table = request('table');
                                $where = request('where');
                                $where = urldecode($where);
                        Severity: Minor
                        Found in src/controllers/CBController.php - About 1 hr to fix

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

                              public function postExportData()
                              {
                                  ini_set('memory_limit', '1024M');
                                  set_time_limit(180);
                          
                          
                          Severity: Minor
                          Found in src/controllers/CBController.php - About 1 hr to fix

                            Method getImportData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getImportData()
                                {
                                    $this->cbLoader();
                                    $data['page_menu'] = Route::getCurrentRoute()->getActionName();
                                    $data['page_title'] = 'Import Data';
                            Severity: Minor
                            Found in src/controllers/CBController.php - About 1 hr to fix

                              Function postActionSelected has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function postActionSelected()
                                  {
                                      $this->cbLoader();
                                      $id_selected = Request::input('checkbox');
                                      $button_name = Request::input('button_name');
                              Severity: Minor
                              Found in src/controllers/CBController.php - About 45 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 checkHideForm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function checkHideForm()
                                  {
                                      if ($this->hide_form && count($this->hide_form)) {
                                          foreach ($this->form as $i => $f) {
                                              if (in_array($f['name'], $this->hide_form)) {
                              Severity: Minor
                              Found in src/controllers/CBController.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

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

                                  public function postDoUploadImportData()
                                  {
                                      $this->cbLoader();
                                      if (Request::hasFile('userfile')) {
                                          $file = Request::file('userfile');
                              Severity: Minor
                              Found in src/controllers/CBController.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

                                              if ($ro['relationship_table']) {
                                                  $datatable = explode(",", $ro['datatable'])[0];
                              
                                                  $foreignKey2 = CRUDBooster::getForeignKey($datatable, $ro['relationship_table']);
                                                  $foreignKey = CRUDBooster::getForeignKey($this->table, $ro['relationship_table']);
                              Severity: Major
                              Found in src/controllers/CBController.php and 1 other location - About 3 hrs to fix
                              src/controllers/CBController.php on lines 1324..1341

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

                              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 ($ro['relationship_table'] && $ro["datatable_orig"] == "") {
                                                  $datatable = explode(",", $ro['datatable'])[0];
                              
                                                  $foreignKey2 = CRUDBooster::getForeignKey($datatable, $ro['relationship_table']);
                                                  $foreignKey = CRUDBooster::getForeignKey($this->table, $ro['relationship_table']);
                              Severity: Major
                              Found in src/controllers/CBController.php and 1 other location - About 3 hrs to fix
                              src/controllers/CBController.php on lines 1303..1320

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

                              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 ($table3 && $column3) {
                                              $table3PK = CB::pk($table3);
                                              $rows->join($table3, $table3.'.'.$table3PK, '=', $table2.'.'.$column2);
                                              $columns = CRUDBooster::getTableColumns($table3);
                                              foreach ($columns as $col) {
                              Severity: Major
                              Found in src/controllers/CBController.php and 1 other location - About 2 hrs to fix
                              src/controllers/CBController.php on lines 796..805

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

                              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 ($table2 && $column2) {
                                              $table2PK = CB::pk($table2);
                                              $rows->join($table2, $table2.'.'.$table2PK, '=', $table1.'.'.$column1);
                                              $columns = CRUDBooster::getTableColumns($table2);
                                              foreach ($columns as $col) {
                              Severity: Major
                              Found in src/controllers/CBController.php and 1 other location - About 2 hrs to fix
                              src/controllers/CBController.php on lines 807..816

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

                              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

                                      if (! CRUDBooster::isDelete() && $this->global_privilege == false || $this->button_delete == false) {
                                          CRUDBooster::insertLog(cbLang("log_try_delete", [
                                              'name' => $row->{$this->title_field},
                                              'module' => CRUDBooster::getCurrentModule()->name,
                                          ]));
                              Severity: Major
                              Found in src/controllers/CBController.php and 2 other locations - About 1 hr to fix
                              src/controllers/CBController.php on lines 1256..1262
                              src/controllers/CBController.php on lines 1441..1447

                              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

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

                                      if (! CRUDBooster::isRead() && $this->global_privilege == false || $this->button_detail == false) {
                                          CRUDBooster::insertLog(cbLang("log_try_view", [
                                              'name' => $row->{$this->title_field},
                                              'module' => CRUDBooster::getCurrentModule()->name,
                                          ]));
                              Severity: Major
                              Found in src/controllers/CBController.php and 2 other locations - About 1 hr to fix
                              src/controllers/CBController.php on lines 1256..1262
                              src/controllers/CBController.php on lines 1410..1416

                              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

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

                                      if (! CRUDBooster::isRead() && $this->global_privilege == false || $this->button_edit == false) {
                                          CRUDBooster::insertLog(cbLang("log_try_edit", [
                                              'name' => $row->{$this->title_field},
                                              'module' => CRUDBooster::getCurrentModule()->name,
                                          ]));
                              Severity: Major
                              Found in src/controllers/CBController.php and 2 other locations - About 1 hr to fix
                              src/controllers/CBController.php on lines 1410..1416
                              src/controllers/CBController.php on lines 1441..1447

                              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

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

                                      if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                                          CRUDBooster::insertLog(cbLang('log_try_add_save', [
                                              'name' => Request::input($this->title_field),
                                              'module' => CRUDBooster::getCurrentModule()->name,
                                          ]));
                              Severity: Major
                              Found in src/controllers/CBController.php and 2 other locations - About 40 mins to fix
                              src/controllers/ModulsController.php on lines 660..666
                              src/controllers/PrivilegesController.php on lines 66..72

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

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

                                      if (! CRUDBooster::isDelete() && $this->global_privilege == false) {
                                          CRUDBooster::insertLog(cbLang("log_try_delete_image", [
                                              'name' => $row->{$this->title_field},
                                              'module' => CRUDBooster::getCurrentModule()->name,
                                          ]));
                              Severity: Major
                              Found in src/controllers/CBController.php and 5 other locations - About 30 mins to fix
                              src/controllers/CBController.php on lines 1277..1280
                              src/controllers/ModulsController.php on lines 754..757
                              src/controllers/PrivilegesController.php on lines 111..117
                              src/controllers/PrivilegesController.php on lines 133..136
                              src/controllers/PrivilegesController.php on lines 197..203

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

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

                                      if (! CRUDBooster::isUpdate() && $this->global_privilege == false) {
                                          CRUDBooster::insertLog(cbLang("log_try_add", ['name' => $row->{$this->title_field}, 'module' => CRUDBooster::getCurrentModule()->name]));
                                          CRUDBooster::redirect(CRUDBooster::adminPath(), cbLang('denied_access'));
                                      }
                              Severity: Major
                              Found in src/controllers/CBController.php and 5 other locations - About 30 mins to fix
                              src/controllers/CBController.php on lines 1713..1719
                              src/controllers/ModulsController.php on lines 754..757
                              src/controllers/PrivilegesController.php on lines 111..117
                              src/controllers/PrivilegesController.php on lines 133..136
                              src/controllers/PrivilegesController.php on lines 197..203

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

                              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