YetiForceCompany/YetiForceCRM

View on GitHub
modules/ISTDN/ISTDN.php

Summary

Maintainability
B
5 hrs
Test Coverage
A
100%

The class ISTDN has 16 fields. Consider redesigning ISTDN to keep the number of fields under 15.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

TooManyFields

Since: 0.1

Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

Example

class Person {
   protected $one;
   private $two;
   private $three;
   [... many more fields ...]
}

Source https://phpmd.org/rules/codesize.html#toomanyfields

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

    public $customFieldTable = ['u_yf_istdncf', 'istdnid'];
Severity: Critical
Found in modules/ISTDN/ISTDN.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 "u_yf_istdn" 3 times.
Open

    public $table_name = 'u_yf_istdn';
Severity: Critical
Found in modules/ISTDN/ISTDN.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 "istdnid" 4 times.
Open

    public $table_index = 'istdnid';
Severity: Critical
Found in modules/ISTDN/ISTDN.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 "vtiger_crmentity" 3 times.
Open

    public $tab_name = ['vtiger_crmentity', 'u_yf_istdn', 'u_yf_istdncf'];
Severity: Critical
Found in modules/ISTDN/ISTDN.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 "assigned_user_id" 3 times.
Open

        'Assigned To' => 'assigned_user_id',
Severity: Critical
Found in modules/ISTDN/ISTDN.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 "subject" 6 times.
Open

        'FL_SUBJECT' => 'subject',
Severity: Critical
Found in modules/ISTDN/ISTDN.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.

Similar blocks of code found in 10 locations. Consider refactoring.
Open

<?php
/**
 * ISTDN CRMEntity Class.
 *
 * @copyright YetiForce S.A.
Severity: Major
Found in modules/ISTDN/ISTDN.php and 9 other locations - About 5 hrs to fix
modules/IGDN/IGDN.php on lines 1..65
modules/IGDNC/IGDNC.php on lines 1..65
modules/IGIN/IGIN.php on lines 1..65
modules/IGRN/IGRN.php on lines 1..65
modules/IGRNC/IGRNC.php on lines 1..65
modules/IIDN/IIDN.php on lines 1..65
modules/IPreOrder/IPreOrder.php on lines 1..65
modules/ISTN/ISTN.php on lines 1..65
modules/ISTRN/ISTRN.php on lines 1..65

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 201.

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

Further Reading

Avoid excessively long variable names like $def_detailview_recname. Keep variable name length under 20.
Open

    public $def_detailview_recname = 'subject';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class ISTDN extends Vtiger_CRMEntity
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 11 and the first side effect is on line 9.
Open

<?php
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

The property $table_name is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $popup_fields is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $def_basicsearch_col is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $tab_name is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $tab_name_index is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $def_detailview_recname is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $default_sort_order is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $list_fields_name is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $default_order_by is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $search_fields_name is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $search_fields is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $table_index is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $mandatory_fields is not named in camelCase.
Open

class ISTDN extends Vtiger_CRMEntity
{
    public $table_name = 'u_yf_istdn';
    public $table_index = 'istdnid';
    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Spaces must be used to indent lines; tabs are not allowed
Open

    // For Popup listview and UI type support
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $customFieldTable = ['u_yf_istdncf', 'istdnid'];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Format: Field Label => fieldname
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $def_detailview_recname = 'subject';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'FL_SUBJECT' => 'subject',
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $table_index = 'istdnid';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'u_yf_istdn' => 'istdnid',
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $search_fields = [
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    ];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $relationFields = [];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // Format: Field Label => Array(tablename, columnname)
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        // tablename should not have prefix 'vtiger_'
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Mandatory table for supporting custom fields.
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    // For Popup window record selection
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $table_name = 'u_yf_istdn';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Assigned To' => 'assigned_user_id',
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $tab_name_index = [
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'u_yf_istdncf' => 'istdnid', ];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'FL_SUBJECT' => ['istdn', 'subject'],
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $mandatory_fields = ['subject', 'assigned_user_id'];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $default_order_by = '';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $popup_fields = ['subject'];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string[] List of fields in the RelationListView
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $lockFields = ['istdn_status' => ['PLL_ACCEPTED']];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Mandatory for Saving, Include tables related to this module.
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Mandatory for Saving, Include tablename and tablekey columnname here.
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    ];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $search_fields_name = [];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $def_basicsearch_col = 'subject';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $default_sort_order = 'ASC';
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $tab_name = ['vtiger_crmentity', 'u_yf_istdn', 'u_yf_istdncf'];
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'vtiger_crmentity' => 'crmid',
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $list_fields_name = [
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    // Column value to use on detail view record text display
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Assigned To' => ['vtiger_crmentity', 'assigned_user_id'],
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    // For Alphabetical search
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    // Used when enabling/disabling the mandatory fields for the module.
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    // Refers to vtiger_field.fieldname values.
Severity: Minor
Found in modules/ISTDN/ISTDN.php by phpcodesniffer

There are no issues that match your filters.

Category
Status