crocodic-studio/crudbooster

View on GitHub

Showing 132 of 160 total issues

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

    private static function cbRoute() {
        Route::group([
            'middleware' => ['web', '\crocodicstudio\crudbooster\middlewares\CBBackend'],
            'prefix' => config('crudbooster.ADMIN_PATH'),
            'namespace' => static::$cb_namespace,
Severity: Minor
Found in src/helpers/CBRouter.php - About 1 hr to fix

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

        public function cbInit()
        {
            $this->table = "cms_statistics";
            $this->primary_key = "id";
            $this->title_field = "name";
    Severity: Minor
    Found in src/controllers/StatisticBuilderController.php - About 1 hr to fix

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

          public function handle($request, Closure $next)
          {
              $admin_path = config('crudbooster.ADMIN_PATH') ?: 'admin';
      
              if (CRUDBooster::myId() == '') {
      Severity: Minor
      Found in src/middlewares/CBBackend.php - About 1 hr to fix

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

            function postSaveSetting()
            {
        
                if (! CRUDBooster::isSuperadmin()) {
                    CRUDBooster::insertLog(cbLang("log_try_view", ['name' => 'Setting', 'module' => 'Setting']));
        Severity: Minor
        Found in src/controllers/SettingsController.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 handle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function handle()
                {
            
                    $this->header();
            
            
            Severity: Minor
            Found in src/commands/CrudboosterInstallationCommand.php - About 1 hr to fix

              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 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 cbInit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function cbInit()
                        {
                            $this->table = 'cms_logs';
                            $this->primary_key = 'id';
                            $this->title_field = "ipaddress";
                    Severity: Minor
                    Found in src/controllers/LogsController.php - About 1 hr to fix

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

                          public function getStep2($id)
                          {
                              $this->cbLoader();
                      
                              $module = CRUDBooster::getCurrentModule();
                      Severity: Minor
                      Found in src/controllers/ModulsController.php - About 1 hr to fix

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

                            private static function userControllerRoute() {
                                Route::group([
                                    'middleware' => ['web', '\crocodicstudio\crudbooster\middlewares\CBBackend'],
                                    'prefix' => config('crudbooster.ADMIN_PATH'),
                                    'namespace' => 'App\Http\Controllers',
                        Severity: Minor
                        Found in src/helpers/CBRouter.php - About 1 hr to fix

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

                              public function postEditSave($id)
                              {
                                  $this->cbLoader();
                          
                                  $row = CRUDBooster::first($this->table, $id);
                          Severity: Minor
                          Found in src/controllers/PrivilegesController.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 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

                            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

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

                                    public function getIndex()
                                    {
                                        $this->cbLoader();
                                
                                        $module = CRUDBooster::getCurrentModule();
                                Severity: Minor
                                Found in src/controllers/MenusController.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 postAddSave has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function postAddSave()
                                      {
                                          $this->cbLoader();
                                  
                                          if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
                                  Severity: Minor
                                  Found in src/controllers/ModulsController.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language