Showing 160 of 160 total issues
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);
- 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 getUrlParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function getUrlParameters($exception = null)
{
@$get = $_GET;
$inputhtml = '';
- 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 postStep2
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function postStep2()
{
$this->cbLoader();
$module = CRUDBooster::getCurrentModule();
- 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 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';
- 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 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') {
- 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 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 !';
}
Method postStepFinish
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postStepFinish()
{
$this->cbLoader();
$id = Request::input('id');
$row = DB::table('cms_moduls')->where('id', $id)->first();
Similar blocks of code found in 2 locations. Consider refactoring. Open
DB::table('cms_menus')->insert([
'created_at' => date('Y-m-d H:i:s'),
'name' => cbLang("text_default_add_new_module", ['module' => $this->arr['name']]),
'icon' => 'fa fa-plus',
'path' => $this->arr['controller'].'GetAdd',
- Read upRead up
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 105.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
DB::table('cms_menus')->insert([
'created_at' => date('Y-m-d H:i:s'),
'name' => cbLang("text_default_list_module", ['module' => $this->arr['name']]),
'icon' => 'fa fa-bars',
'path' => $this->arr['controller'].'GetIndex',
- Read upRead up
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 105.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method postAddSave
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postAddSave()
{
$this->cbLoader();
if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
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,
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,
]));
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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,
]));
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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,
]));
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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);