crocodic-studio/crudbooster

View on GitHub
src/controllers/ApiCustomController.php

Summary

Maintainability
D
1 day
Test Coverage

Function getColumnTable has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    function getColumnTable($table, $type = 'list')
    {
        $this->cbLoader();
        $result = [];

Severity: Minor
Found in src/controllers/ApiCustomController.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

File ApiCustomController.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php namespace crocodicstudio\crudbooster\controllers;

use CRUDbooster;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Excel;
Severity: Minor
Found in src/controllers/ApiCustomController.php - About 2 hrs to fix

    Function getDownloadPostman has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        function getDownloadPostman()
        {
            $this->cbLoader();
            $data = [];
            $data['variables'] = [];
    Severity: Minor
    Found in src/controllers/ApiCustomController.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 postSaveApiCustom has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function postSaveApiCustom()
        {
            $this->cbLoader();
            $posts = Request::all();
    
    
    Severity: Major
    Found in src/controllers/ApiCustomController.php - About 2 hrs to fix

      Method getDownloadPostman has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function getDownloadPostman()
          {
              $this->cbLoader();
              $data = [];
              $data['variables'] = [];
      Severity: Major
      Found in src/controllers/ApiCustomController.php - About 2 hrs to fix

        Method getColumnTable has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function getColumnTable($table, $type = 'list')
            {
                $this->cbLoader();
                $result = [];
        
        
        Severity: Minor
        Found in src/controllers/ApiCustomController.php - About 1 hr to fix

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

              function postSaveApiCustom()
              {
                  $this->cbLoader();
                  $posts = Request::all();
          
          
          Severity: Minor
          Found in src/controllers/ApiCustomController.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

          There are no issues that match your filters.

          Category
          Status