YetiForceCompany/YetiForceCRM

View on GitHub
modules/KnowledgeBase/ConfigTemplate.php

Summary

Maintainability
A
0 mins
Test Coverage
F
45%

Call to method naturalNumber from undeclared class \App\Validator (Did you mean class \Tests\App\Validator)
Open

            return $arg && \App\Validator::naturalNumber($arg);
Severity: Critical
Found in modules/KnowledgeBase/ConfigTemplate.php by phan

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

        'validation' => function () {

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 "description" 4 times.
Open

        'description' => 'Default view for record detail view. Values: LBL_RECORD_DETAILS or LBL_RECORD_SUMMARY',

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 "default" 4 times.
Open

        'default' => 'LBL_RECORD_PREVIEW',

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.

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

        'default' => 'KnowledgeBase',

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

            return 'List' === $arg || 'ListPreview' === $arg || 'DashBoard' === $arg || 'KnowledgeBase' === $arg;

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

        }

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

    ],

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

        'description' => 'Article limit in the knowledge base window',

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

            return $arg && \App\Validator::naturalNumber($arg);

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

        'validation' => function () {

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

            return \in_array($arg, ['LBL_RECORD_PREVIEW', 'LBL_RECORD_SUMMARY', 'LBL_RECORD_DETAILS']);

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

            $arg = func_get_arg(0);

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

        'description' => 'Default view for record detail view. Values: LBL_RECORD_DETAILS or LBL_RECORD_SUMMARY',

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

            $arg = func_get_arg(0);

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

    'rename' => [

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

        }

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

    ],

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

        }

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

        'description' => 'If 1 and filename exists, RENAME file, adding "_NR" to the end of filename (name_1.ext, name_2.ext, ..) If 0, will OVERWRITE the existing file',

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

        'validation' => function () {

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

    'knowledgeBaseArticleLimit' => [

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

    ],

Line exceeds 120 characters; contains 150 characters
Open

        'description' => 'Default module view. Values: KnowledgeBase, List, ListPreview or DashBoard, refresh menu files after you change this value',

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

        'default' => 1,

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

    ],

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

        'default' => 50,

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

            $arg = func_get_arg(0);

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

        'description' => 'Default module view. Values: KnowledgeBase, List, ListPreview or DashBoard, refresh menu files after you change this value',

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

        'validation' => function () {

Line exceeds 120 characters; contains 170 characters
Open

        'description' => 'If 1 and filename exists, RENAME file, adding "_NR" to the end of filename (name_1.ext, name_2.ext, ..) If 0, will OVERWRITE the existing file',

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

    'DEFAULT_VIEW_RECORD' => [

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

    'defaultViewName' => [

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

        'default' => 'LBL_RECORD_PREVIEW',

There are no issues that match your filters.

Category
Status