YetiForceCompany/YetiForceCRM

View on GitHub
user_privileges/user_privileges_1.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Define a constant instead of duplicating this literal "Administrator" 3 times.
Open

$user_info=['user_name'=>'admin','is_admin'=>'on','user_password'=>'$2y$10$mvy47VqQjd853TpAUr5aE.pd2fSTjBv.Z3G0g8AqyPwPNcV/YtB02','confirm_password'=>'','first_name'=>'','last_name'=>'Administrator','roleid'=>'H2','email1'=>'help@yetiforce.com','status'=>'Active','activity_view'=>'This Month','hour_format'=>'24','start_hour'=>'08:00','reports_to_id'=>0,'date_format'=>'yyyy-mm-dd','description'=>'','accesskey'=>'aOFXop10GCJ1uw0P','time_zone'=>'Europe/Sarajevo','currency_id'=>1,'currency_grouping_pattern'=>'123456789','currency_decimal_separator'=>'.','currency_grouping_separator'=>' ','currency_symbol_placement'=>'1.0$','imagename'=>'','internal_mailer'=>1,'theme'=>'twilight','language'=>'en-US','reminder_interval'=>'15 Minutes','phone_crm_extension'=>'','no_of_currency_decimals'=>'2','truncate_trailing_zeros'=>1,'dayoftheweek'=>'Monday','othereventduration'=>'[{"activitytype":"Call","duration":"60"},{"activitytype":"Meeting","duration":"60"},{"activitytype":"Task","duration":"60"}]','default_record_view'=>'Summary','leftpanelhide'=>0,'rowheight'=>'medium','defaulteventstatus'=>'PLL_PLANNED','defaultactivitytype'=>'Meeting','is_owner'=>'1','end_hour'=>'23:00','emailoptout'=>1,'available'=>1,'auto_assign'=>0,'view_date_format'=>'PLL_ELAPSED','login_method'=>'PLL_PASSWORD','sync_carddav'=>'PLL_OWNER','sync_caldav'=>'PLL_OWNER','secondary_email'=>'','default_search_operator'=>'PLL_CONTAINS','super_user'=>1,'currency_name'=>'Poland, Zlotych','currency_code'=>'PLN','currency_symbol'=>'zł','conv_rate'=>'1.00000','id'=>1];
Severity: Critical
Found in user_privileges/user_privileges_1.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "PLL_OWNER" 4 times.
Open

$user_info=['user_name'=>'admin','is_admin'=>'on','user_password'=>'$2y$10$mvy47VqQjd853TpAUr5aE.pd2fSTjBv.Z3G0g8AqyPwPNcV/YtB02','confirm_password'=>'','first_name'=>'','last_name'=>'Administrator','roleid'=>'H2','email1'=>'help@yetiforce.com','status'=>'Active','activity_view'=>'This Month','hour_format'=>'24','start_hour'=>'08:00','reports_to_id'=>0,'date_format'=>'yyyy-mm-dd','description'=>'','accesskey'=>'aOFXop10GCJ1uw0P','time_zone'=>'Europe/Sarajevo','currency_id'=>1,'currency_grouping_pattern'=>'123456789','currency_decimal_separator'=>'.','currency_grouping_separator'=>' ','currency_symbol_placement'=>'1.0$','imagename'=>'','internal_mailer'=>1,'theme'=>'twilight','language'=>'en-US','reminder_interval'=>'15 Minutes','phone_crm_extension'=>'','no_of_currency_decimals'=>'2','truncate_trailing_zeros'=>1,'dayoftheweek'=>'Monday','othereventduration'=>'[{"activitytype":"Call","duration":"60"},{"activitytype":"Meeting","duration":"60"},{"activitytype":"Task","duration":"60"}]','default_record_view'=>'Summary','leftpanelhide'=>0,'rowheight'=>'medium','defaulteventstatus'=>'PLL_PLANNED','defaultactivitytype'=>'Meeting','is_owner'=>'1','end_hour'=>'23:00','emailoptout'=>1,'available'=>1,'auto_assign'=>0,'view_date_format'=>'PLL_ELAPSED','login_method'=>'PLL_PASSWORD','sync_carddav'=>'PLL_OWNER','sync_caldav'=>'PLL_OWNER','secondary_email'=>'','default_search_operator'=>'PLL_CONTAINS','super_user'=>1,'currency_name'=>'Poland, Zlotych','currency_code'=>'PLN','currency_symbol'=>'zł','conv_rate'=>'1.00000','id'=>1];
Severity: Critical
Found in user_privileges/user_privileges_1.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Line exceeds 120 characters; contains 2481 characters
Open

return ['details'=>['user_name'=>'admin','is_admin'=>'1','user_password'=>'$2y$10$mvy47VqQjd853TpAUr5aE.pd2fSTjBv.Z3G0g8AqyPwPNcV/YtB02','confirm_password'=>'','first_name'=>'','last_name'=>'Administrator','roleid'=>'H2','email1'=>'help@yetiforce.com','status'=>'Active','activity_view'=>'This Month','hour_format'=>'24','start_hour'=>'08:00','reports_to_id'=>0,'date_format'=>'yyyy-mm-dd','description'=>'','accesskey'=>'aOFXop10GCJ1uw0P','time_zone'=>'Europe/Sarajevo','currency_id'=>1,'currency_grouping_pattern'=>'123456789','currency_decimal_separator'=>'.','currency_grouping_separator'=>' ','currency_symbol_placement'=>'1.0$','imagename'=>'','internal_mailer'=>1,'theme'=>'twilight','language'=>'en-US','reminder_interval'=>'15 Minutes','phone_crm_extension'=>'','no_of_currency_decimals'=>'2','truncate_trailing_zeros'=>1,'dayoftheweek'=>'Monday','othereventduration'=>'[{"activitytype":"Call","duration":"60"},{"activitytype":"Meeting","duration":"60"},{"activitytype":"Task","duration":"60"}]','default_record_view'=>'Summary','leftpanelhide'=>0,'rowheight'=>'medium','defaulteventstatus'=>'PLL_PLANNED','defaultactivitytype'=>'Meeting','is_owner'=>'1','end_hour'=>'23:00','emailoptout'=>1,'available'=>1,'auto_assign'=>0,'records_limit'=>'','phone_crm_extension_extra'=>'','date_password_change'=>'','force_password_change'=>'','view_date_format'=>'PLL_ELAPSED','authy_methods'=>'','authy_secret_totp'=>'','login_method'=>'PLL_PASSWORD','sync_carddav'=>'PLL_OWNER','sync_caldav'=>'PLL_OWNER','sync_carddav_default_country'=>'','default_search_module'=>'','default_search_override'=>'','primary_phone_extra'=>'','primary_phone'=>'','mail_scanner_actions'=>'','mail_scanner_fields'=>'','secondary_email'=>'','default_search_operator'=>'PLL_CONTAINS','super_user'=>1,'calendar_all_users_by_default'=>'','currency_name'=>'Poland, Zlotych','currency_code'=>'PLN','currency_symbol'=>'zł','conv_rate'=>'1.00000','record_id'=>1,'record_module'=>'Users'],'displayName'=>'Administrator','profiles'=>[1],'groups'=>[3],'leadersByGroup'=>[],'leader'=>[],'parent_roles'=>['H1'],'parent_role_seq'=>'H1::H2','roleName'=>'Board of Management','multiCompanyId'=>1,'multiCompanyLogo'=>['name'=>'logo_yetiforce.png','size'=>'3 KB','path'=>'public_html/layouts/resources/Logo/logo_login_page.png','key'=>'11111111111111111111111111111111111111111111111111'],'multiCompanyLogoUrl'=>'file.php?module=MultiCompany&action=Logo&record=1&key=11111111111111111111111111111111111111111111111111'];

Line exceeds 120 characters; contains 1541 characters
Open

$user_info=['user_name'=>'admin','is_admin'=>'on','user_password'=>'$2y$10$mvy47VqQjd853TpAUr5aE.pd2fSTjBv.Z3G0g8AqyPwPNcV/YtB02','confirm_password'=>'','first_name'=>'','last_name'=>'Administrator','roleid'=>'H2','email1'=>'help@yetiforce.com','status'=>'Active','activity_view'=>'This Month','hour_format'=>'24','start_hour'=>'08:00','reports_to_id'=>0,'date_format'=>'yyyy-mm-dd','description'=>'','accesskey'=>'aOFXop10GCJ1uw0P','time_zone'=>'Europe/Sarajevo','currency_id'=>1,'currency_grouping_pattern'=>'123456789','currency_decimal_separator'=>'.','currency_grouping_separator'=>' ','currency_symbol_placement'=>'1.0$','imagename'=>'','internal_mailer'=>1,'theme'=>'twilight','language'=>'en-US','reminder_interval'=>'15 Minutes','phone_crm_extension'=>'','no_of_currency_decimals'=>'2','truncate_trailing_zeros'=>1,'dayoftheweek'=>'Monday','othereventduration'=>'[{"activitytype":"Call","duration":"60"},{"activitytype":"Meeting","duration":"60"},{"activitytype":"Task","duration":"60"}]','default_record_view'=>'Summary','leftpanelhide'=>0,'rowheight'=>'medium','defaulteventstatus'=>'PLL_PLANNED','defaultactivitytype'=>'Meeting','is_owner'=>'1','end_hour'=>'23:00','emailoptout'=>1,'available'=>1,'auto_assign'=>0,'view_date_format'=>'PLL_ELAPSED','login_method'=>'PLL_PASSWORD','sync_carddav'=>'PLL_OWNER','sync_caldav'=>'PLL_OWNER','secondary_email'=>'','default_search_operator'=>'PLL_CONTAINS','super_user'=>1,'currency_name'=>'Poland, Zlotych','currency_code'=>'PLN','currency_symbol'=>'zł','conv_rate'=>'1.00000','id'=>1];

There are no issues that match your filters.

Category
Status