crocodic-studio/crudbooster

View on GitHub
src/helpers/CRUDBooster.php

Summary

Maintainability
F
1 wk
Test Coverage

File CRUDBooster.php has 1377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace crocodicstudio\crudbooster\helpers;

use Cache;
Severity: Major
Found in src/helpers/CRUDBooster.php - About 3 days to fix

    CRUDBooster has 73 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CRUDBooster
    {
        /**
         *    Comma-delimited data output from the child table
         */
    Severity: Major
    Found in src/helpers/CRUDBooster.php - About 1 day to fix

      Method generateController has 258 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function generateController($table, $name = null)
          {
      
              $exception = ['id', 'created_at', 'updated_at', 'deleted_at'];
              $image_candidate = explode(',', config('crudbooster.IMAGE_FIELDS_CANDIDATE'));
      Severity: Major
      Found in src/helpers/CRUDBooster.php - About 1 day to fix

        Function generateController has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function generateController($table, $name = null)
            {
        
                $exception = ['id', 'created_at', 'updated_at', 'deleted_at'];
                $image_candidate = explode(',', config('crudbooster.IMAGE_FIELDS_CANDIDATE'));
        Severity: Minor
        Found in src/helpers/CRUDBooster.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 sidebarMenu has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function sidebarMenu()
            {
                $menu_active = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".self::myPrivilegeId()."')")->where('parent_id', 0)->where('is_active', 1)->where('is_dashboard', 0)->orderby('sorting', 'asc')->select('cms_menus.*')->get();
        
                foreach ($menu_active as &$menu) {
        Severity: Minor
        Found in src/helpers/CRUDBooster.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

        Method sidebarMenu has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function sidebarMenu()
            {
                $menu_active = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".self::myPrivilegeId()."')")->where('parent_id', 0)->where('is_active', 1)->where('is_dashboard', 0)->orderby('sorting', 'asc')->select('cms_menus.*')->get();
        
                foreach ($menu_active as &$menu) {
        Severity: Major
        Found in src/helpers/CRUDBooster.php - About 2 hrs to fix

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

              public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
              {
                  if (Request::hasFile($name)) {
                      if (! self::myId()) {
                          $userID = 0;
          Severity: Minor
          Found in src/helpers/CRUDBooster.php - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method sendEmail has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function sendEmail($config = [])
              {
          
                  \Config::set('mail.driver', self::getSetting('smtp_driver'));
                  \Config::set('mail.host', self::getSetting('smtp_host'));
          Severity: Minor
          Found in src/helpers/CRUDBooster.php - About 1 hr to fix

            Function urlFilterColumn has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function urlFilterColumn($key, $type, $value = '', $singleSorting = true)
                {
                    $params = Request::all();
                    $mainpath = trim(self::mainpath(), '/');
            
            
            Severity: Minor
            Found in src/helpers/CRUDBooster.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 resizeImage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
                {
                    $images_ext = config('crudbooster.IMAGE_EXTENSIONS', 'jpg,png,gif,bmp');
                    $images_ext = explode(',', $images_ext);
            
            
            Severity: Minor
            Found in src/helpers/CRUDBooster.php - About 1 hr to fix

              Method uploadFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
                  {
                      if (Request::hasFile($name)) {
                          if (! self::myId()) {
                              $userID = 0;
              Severity: Minor
              Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

                    public static function sendEmailQueue($queue)
                    {
                        \Config::set('mail.driver', self::getSetting('smtp_driver'));
                        \Config::set('mail.host', self::getSetting('smtp_host'));
                        \Config::set('mail.port', self::getSetting('smtp_port'));
                Severity: Minor
                Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

                      public static function authAPI()
                      {
                          $allowedUserAgent = config('crudbooster.API_USER_AGENT_ALLOWED');
                          $user_agent = Request::header('User-Agent');
                          $authorization = Request::header('Authorization');
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.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 getNameTable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getNameTable($columns)
                      {
                          $name_col_candidate = config('crudbooster.NAME_FIELDS_CANDIDATE');
                          $name_col_candidate = explode(',', $name_col_candidate);
                          $name_col = '';
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.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 resizeImage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
                      {
                          $images_ext = config('crudbooster.IMAGE_EXTENSIONS', 'jpg,png,gif,bmp');
                          $images_ext = explode(',', $images_ext);
                  
                  
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.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 getUrlParameters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getUrlParameters($exception = null)
                      {
                          @$get = $_GET;
                          $inputhtml = '';
                  
                  
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.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 isForeignKey has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function isForeignKey($fieldName)
                      {
                          if (substr($fieldName, 0, 3) == 'id_') {
                              $table = substr($fieldName, 3);
                          } elseif (substr($fieldName, -3) == '_id') {
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.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 sendFCM has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function sendFCM($regID = [], $data)
                      {
                          if (! $data['title'] || ! $data['content']) {
                              return 'title , content null !';
                          }
                  Severity: Minor
                  Found in src/helpers/CRUDBooster.php - About 1 hr to fix

                    Method timeAgo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function timeAgo($datetime_to, $datetime_from = null, $full = false)
                        {
                            $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
                            $now = new \DateTime;
                            if ($datetime_from != '') {
                    Severity: Minor
                    Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

                          public static function authAPI()
                          {
                              $allowedUserAgent = config('crudbooster.API_USER_AGENT_ALLOWED');
                              $user_agent = Request::header('User-Agent');
                              $authorization = Request::header('Authorization');
                      Severity: Minor
                      Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

                            public static function generateAPI($controller_name, $table_name, $permalink, $method_type = 'post')
                            {
                                $php = '
                                <?php namespace App\Http\Controllers;
                        
                        
                        Severity: Minor
                        Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

                              public static function routeController($prefix, $controller, $namespace = null)
                              {
                          
                                  $prefix = trim($prefix, '/').'/';
                          
                          
                          Severity: Minor
                          Found in src/helpers/CRUDBooster.php - About 1 hr to fix

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

                                public static function isCRUD()
                                {
                                    if (self::isSuperadmin()) {
                                        return true;
                                    }
                            Severity: Minor
                            Found in src/helpers/CRUDBooster.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 routeController has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function routeController($prefix, $controller, $namespace = null)
                                {
                            
                                    $prefix = trim($prefix, '/').'/';
                            
                            
                            Severity: Minor
                            Found in src/helpers/CRUDBooster.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 valid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function valid($arr = [], $type = 'json')
                                {
                                    $input_arr = Request::all();
                            
                                    foreach ($arr as $a => $b) {
                            Severity: Minor
                            Found in src/helpers/CRUDBooster.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 getModulePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function getModulePath()
                                {
                                    // Check to position of admin_path
                                    if(config("crudbooster.ADMIN_PATH")) {
                                        $adminPathSegments = explode('/', Request::path());
                            Severity: Minor
                            Found in src/helpers/CRUDBooster.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

                            Method uploadFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public static function uploadFile($name, $encrypt = false, $resize_width = null, $resize_height = null, $id = null)
                            Severity: Minor
                            Found in src/helpers/CRUDBooster.php - About 35 mins to fix

                              Method resizeImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  private static function resizeImage($fullFilePath, $resize_width = null, $resize_height = null, $qty = 100, $thumbQty = 75)
                              Severity: Minor
                              Found in src/helpers/CRUDBooster.php - About 35 mins to fix

                                Method get has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public static function get($table, $string_conditions = null, $orderby = null, $limit = null, $skip = null)
                                Severity: Minor
                                Found in src/helpers/CRUDBooster.php - About 35 mins to fix

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

                                      public static function sendEmail($config = [])
                                      {
                                  
                                          \Config::set('mail.driver', self::getSetting('smtp_driver'));
                                          \Config::set('mail.host', self::getSetting('smtp_host'));
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.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 myPrivilege has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function myPrivilege()
                                      {
                                          $roles = Session::get('admin_privileges_roles');
                                          if ($roles) {
                                              foreach ($roles as $role) {
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.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 listTables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function listTables()
                                      {
                                          $tables = [];
                                          $multiple_db = config('crudbooster.MULTIPLE_DATABASE_MODULE');
                                          $multiple_db = ($multiple_db) ? $multiple_db : [];
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.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 timeAgo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function timeAgo($datetime_to, $datetime_from = null, $full = false)
                                      {
                                          $datetime_from = ($datetime_from) ?: date('Y-m-d H:i:s');
                                          $now = new \DateTime;
                                          if ($datetime_from != '') {
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.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 uploadBase64 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function uploadBase64($value, $id = null)
                                      {
                                          if (! self::myId()) {
                                              $userID = 0;
                                          } else {
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.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

                                              try {
                                                  switch ($menu->type) {
                                                      case 'Route':
                                                          $url = route($menu->path);
                                                          break;
                                  Severity: Major
                                  Found in src/helpers/CRUDBooster.php and 1 other location - About 2 hrs to fix
                                  src/helpers/CRUDBooster.php on lines 483..504

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

                                  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

                                                      try {
                                                          switch ($c->type) {
                                                              case 'Route':
                                                                  $url = route($c->path);
                                                                  break;
                                  Severity: Major
                                  Found in src/helpers/CRUDBooster.php and 1 other location - About 2 hrs to fix
                                  src/helpers/CRUDBooster.php on lines 451..473

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

                                  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 (substr($fieldName, 0, 3) == 'id_') {
                                              $table = substr($fieldName, 3);
                                          } elseif (substr($fieldName, -3) == '_id') {
                                              $table = substr($fieldName, 0, (strlen($fieldName) - 3));
                                          }
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.php and 1 other location - About 30 mins to fix
                                  src/helpers/CRUDBooster.php on lines 1016..1020

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

                                  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 (substr($fieldName, 0, 3) == 'id_') {
                                              $table = substr($fieldName, 3);
                                          } elseif (substr($fieldName, -3) == '_id') {
                                              $table = substr($fieldName, 0, (strlen($fieldName) - 3));
                                          }
                                  Severity: Minor
                                  Found in src/helpers/CRUDBooster.php and 1 other location - About 30 mins to fix
                                  src/helpers/CRUDBooster.php on lines 1005..1009

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

                                  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