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,
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";
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() == '') {
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']));
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 != '') {
Method handle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$this->header();
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);
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');
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;
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";
Method getStep2
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStep2($id)
{
$this->cbLoader();
$module = CRUDBooster::getCurrentModule();
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',
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);
- Read upRead up
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, '/').'/';
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);
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';
Method getIndex
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIndex()
{
$this->cbLoader();
$module = CRUDBooster::getCurrentModule();
Function isCRUD
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isCRUD()
{
if (self::isSuperadmin()) {
return true;
}
- Read upRead up
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, '/').'/';
- Read upRead up
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) {
- Read upRead up
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"