YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/ConfigEditor/models/Module.php

Summary

Maintainability
C
1 day
Test Coverage
F
0%

Method getFieldInstanceByName has 134 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getFieldInstanceByName($name)
    {
        $moduleName = $this->getName(true);
        $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];
        switch ($name) {
Severity: Major
Found in modules/Settings/ConfigEditor/models/Module.php - About 5 hrs to fix

    Function getFieldInstanceByName has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFieldInstanceByName($name)
        {
            $moduleName = $this->getName(true);
            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];
            switch ($name) {
    Severity: Minor
    Found in modules/Settings/ConfigEditor/models/Module.php - About 2 hrs to fix

    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 getEditFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getEditFields($configName = null): array
        {
            $fields = [];
            switch ($configName ?? $this->type) {
                case 'Main':
    Severity: Minor
    Found in modules/Settings/ConfigEditor/models/Module.php - About 25 mins to fix

    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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function init(string $type = 'Main')
        {
            $this->type = $type;
            foreach (array_keys($this->getEditFields()) as $fieldName) {
                $source = $this->getFieldInstanceByName($fieldName)->get('source');
    Severity: Minor
    Found in modules/Settings/ConfigEditor/models/Module.php - About 25 mins to fix

    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

    The method getFieldInstanceByName() has 139 lines of code. Current threshold is set to 100. Avoid really long methods.
    Open

        public function getFieldInstanceByName($name)
        {
            $moduleName = $this->getName(true);
            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];
            switch ($name) {

    The method getFieldInstanceByName() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
    Open

        public function getFieldInstanceByName($name)
        {
            $moduleName = $this->getName(true);
            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];
            switch ($name) {

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

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

    Missing class import via use statement (line '290', column '19').
    Open

                    $config = new \App\ConfigFile('component', 'Branding');

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid using static access to class '\App\YetiForce\Shop' in method 'getFieldInstanceByName'.
    Open

                    $params['isEditableReadOnly'] = !\App\YetiForce\Shop::check('YetiForceDisableBranding');

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Config' in method 'init'.
    Open

                    $value = \App\Config::{$type}($component, $fieldName);

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'Settings_Vtiger_Field_Model' in method 'getFieldInstanceByName'.
    Open

            return Settings_Vtiger_Field_Model::init($moduleName, $params);

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\vtlib\Functions' in method 'getFieldInstanceByName'.
    Open

                    foreach (\vtlib\Functions::getAllModules(true, false, 0) as $module) {

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Config' in method 'getFieldInstanceByName'.
    Open

                    $params['maximumlength'] = (string) round(\App\Config::getMaxUploadSize(false, true), 0) ?: '';

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    The method init uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                } else {
                    $value = \App\Config::{$type}($fieldName);
                }

    ElseExpression

    Since: 1.4.0

    An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($flag) {
                // one branch
            } else {
                // another branch
            }
        }
    }

    Source https://phpmd.org/rules/cleancode.html#elseexpression

    Avoid using static access to class '\App\Config' in method 'init'.
    Open

                    $value = \App\Config::{$type}($fieldName);

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Layout' in method 'getFieldInstanceByName'.
    Open

                    $params['picklistValues'] = \App\Layout::getAllLayouts();

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\YetiForce\Shop' in method 'getFieldInstanceByName'.
    Open

                    $params['isEditableReadOnly'] = !\App\YetiForce\Shop::check('YetiForceDisableBranding');

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'Settings_Vtiger_MenuItem_Model' in method 'getMenuItem'.
    Open

            return Settings_Vtiger_MenuItem_Model::getInstance('LBL_CONFIG_EDITOR');

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Language' in method 'getFieldInstanceByName'.
    Open

                        $params['picklistValues'][$module['name']] = \App\Language::translate($module['name'], $module['name']);

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Language' in method 'getFieldInstanceByName'.
    Open

                    $params['picklistValues'] = ['Home' => \App\Language::translate('Home')];

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\App\Language' in method 'getDisplayValue'.
    Open

                    $value = $this->get($name) . ' ' . \App\Language::translate('LBL_MB', $this->getName(true));

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

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

                    $params['validator'] = [['name' => 'WholeNumberGreaterThanZero']];

    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 "validator" 13 times.
    Open

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

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

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

    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 "relation" 3 times.
    Open

                    $params['source'] = 'relation';

    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 "fieldvalue" 6 times.
    Open

                    $params['fieldvalue'] = $this->get($name);

    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 "purifyType" 14 times.
    Open

                    $params['purifyType'] = \App\Purifier::TEXT;

    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 "source" 9 times.
    Open

                $source = $this->getFieldInstanceByName($fieldName)->get('source');

    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 "uitype" 13 times.
    Open

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

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

            'upload_maxsize' => 'LBL_MAX_UPLOAD_SIZE',

    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 "isEditableReadOnly" 3 times.
    Open

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

    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 "picklistValues" 3 times.
    Open

                    $params['picklistValues'] = ['Home' => \App\Language::translate('Home')];

    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 "maximumlength" 11 times.
    Open

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

    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 "label" 12 times.
    Open

                    $params['label'] = $this->performanceFields[$name];

    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.

    Avoid unused parameters such as '$name'.
    Open

        public static function getInstance($name = 'Settings:Vtiger')

    UnusedFormalParameter

    Since: 0.2

    Avoid passing parameters to methods or constructors and then not using those parameters.

    Example

    class Foo
    {
        private function bar($howdy)
        {
            // $howdy is not used
        }
    }

    Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

    Call to method check from undeclared class \App\YetiForce\Shop
    Open

                    $params['isEditableReadOnly'] = !\App\YetiForce\Shop::check('YetiForceDisableBranding');

    Return type of getMenuItem() is undeclared type \menu (Did you mean class \vtlib\Menu)
    Open

        public function getMenuItem()

    Returning type \Settings_Vtiger_MenuItem_Model but getMenuItem() is declared to return \menu
    Open

            return Settings_Vtiger_MenuItem_Model::getInstance('LBL_CONFIG_EDITOR');

    Call to method get from undeclared class \menu (Did you mean class \vtlib\Menu)
    Open

            return 'index.php?module=ConfigEditor&parent=Settings&view=Detail&block=' . $menuItem->get('blockid') . '&fieldid=' . $menuItem->get('fieldid');

    Call to method get from undeclared class \menu (Did you mean class \vtlib\Menu)
    Open

            return 'index.php?module=ConfigEditor&parent=Settings&view=Edit&block=' . $menuItem->get('blockid') . '&fieldid=' . $menuItem->get('fieldid');

    Call to method check from undeclared class \App\YetiForce\Shop
    Open

                    $params['isEditableReadOnly'] = !\App\YetiForce\Shop::check('YetiForceDisableBranding');

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

    class Settings_ConfigEditor_Module_Model extends Settings_Vtiger_Module_Model

    The class Settings_ConfigEditor_Module_Model is not named in CamelCase.
    Open

    class Settings_ConfigEditor_Module_Model extends Settings_Vtiger_Module_Model
    {
        /** {@inheritdoc} */
        public $name = 'ConfigEditor';
        /** {@inheritdoc} */

    CamelCaseClassName

    Since: 0.2

    It is considered best practice to use the CamelCase notation to name classes.

    Example

    class class_name {
    }

    Source

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

                    $value = \App\Config::{$type}($fieldName);

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

            return $this;

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

                    $fields = $this->brandingFields;

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

            }

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

            'listMaxEntriesMassEdit' => 'LBL_LIST_MAX_ENTRIES_MASSEDIT',

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

            'MAX_NUMBER_EXPORT_RECORDS' => 'LBL_MAX_NUMBER_EXPORT_RECORDS'

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

        /** @var array Fields for branding */

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

         */

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

        public function init(string $type = 'Main')

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

         *

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

                    break;

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

            'COMMENT_MAX_LENGTH' => 'LBL_RELATION_COMMENT_MAX_LENGTH',

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

            $this->type = $type;

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

        /**

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

         * @param mixed|null $configName

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

            $fields = [];

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

        /** {@inheritdoc} */

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

        }

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

            'SHOW_RECORDS_COUNT' => 'LBL_RELATION_SHOW_RECORDS_COUNT',

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

                    $value = \App\Config::{$type}($component, $fieldName);

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

                }

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

        public $performanceFields = [

    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

                case 'Performance':

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

                case 'Branding':

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

        /**

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

        public $name = 'ConfigEditor';

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

            'layoutInLoginView' => 'LBL_SHOW_LAYOUT_IN_LOGIN_PAGE',

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

        /** @var array Fields for relation */

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

            'urlTwitter' => 'LBL_TWITTER'

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

         * @throws \ReflectionException

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

         * Gets fields for edit.

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

         * @return array

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

        {

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

                    $fields = $this->listFields;

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

                    $fields = $this->relationFields;

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

            'backgroundClosingModal' => 'LBL_BG_CLOSING_MODAL',

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

        /** @var array Fields for performance */

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

            'separateChangeRelationButton' => 'LBL_RELATION_SEPARATE_CHANGE_RELATION_BUTTON',

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

         *

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

                    $value /= 1048576;

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

        public $listFields = [

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

            'langInLoginView' => 'LBL_SHOW_LANG_IN_LOGIN_PAGE',

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

        ];

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

            'urlFacebook' => 'LBL_FACEBOOK',

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

            foreach (array_keys($this->getEditFields()) as $fieldName) {

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

                } else {

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

        public function getEditFields($configName = null): array

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

            'list_max_entries_per_page' => 'LBL_MAX_ENTRIES_PER_PAGE_IN_LISTVIEW',

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

            'SHOW_RELATED_ICON' => 'LBL_RELATION_SHOW_RELATED_ICON',

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

            'urlLinkedIn' => 'LBL_LINKEDIN',

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

        /**

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

         * Function to initiation.

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

                    break;

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

                    $fields = $this->performanceFields;

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

                    break;

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

         * Function to get CompanyDetails Menu item.

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

            'breadcrumbs' => 'LBL_SHOWING_BREADCRUMBS',

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

        public $relationFields = [

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

                [$type, $component] = strpos($source, ':') ? explode(':', $source, 2) : [$source, ''];

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

        /** {@inheritdoc} */

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

            'default_module' => 'LBL_DEFAULT_MODULE',

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

            'defaultLayout' => 'LBL_DEFAULT_LAYOUT',

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

        public $brandingFields = [

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

        /** @var string Configuration type */

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

                if ('upload_maxsize' === $fieldName) {

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

        }

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

            'SHOW_RELATED_MODULE_NAME' => 'LBL_RELATION_SHOW_RELATED_MODULE_NAME',

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

                if ($component) {

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

                $this->set($fieldName, $value);

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

         */

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

                    break;

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

            'MINIMUM_CRON_FREQUENCY' => 'LBL_MINIMUM_CRON_FREQUENCY',

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

            'footerName' => 'LBL_BRAND_DATA_NAME',

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

                $source = $this->getFieldInstanceByName($fieldName)->get('source');

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

                default:

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

            'listview_max_textlength' => 'LBL_MAX_TEXT_LENGTH_IN_LISTVIEW',

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

            'title_max_length' => 'LBL_TITLE_MAX_LENGTH',

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

        ];

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

        public $type;

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

         * @param string $type

    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

            'href_max_length' => 'LBL_HREF_MAX_LEGTH',

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

        {

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

                    break;

    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

                    $params['validator'] = [['name' => 'WholeNumberGreaterThanZero']];

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

                    $params['fieldvalue'] = $this->get($name);

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

                    unset($params['validator']);

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

                    $params['fieldvalue'] = $this->get($name);

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

                    $params['typeofdata'] = 'C~M';

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

            'upload_maxsize' => 'LBL_MAX_UPLOAD_SIZE',

    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

            switch ($configName ?? $this->type) {

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

                case 'Main':

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

                case 'Relation':

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

            return $fields;

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

        }

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

            $menuItem = $this->getMenuItem();

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

            return 'index.php?module=ConfigEditor&parent=Settings&view=Edit&block=' . $menuItem->get('blockid') . '&fieldid=' . $menuItem->get('fieldid');

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

                    $params['maximumlength'] = '40';

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

                    $params['picklistValues'] = ['Home' => \App\Language::translate('Home')];

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

                    unset($params['validator']);

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

                    $params['uitype'] = 7;

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

                case 'SHOW_RELATED_MODULE_NAME':

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

                    $params['purifyType'] = \App\Purifier::BOOL;

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

                    $params['maximumlength'] = '0,100';

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

         * Function to get Edit view Url.

    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

        public function getDetailViewUrl()

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

            return 'index.php?module=ConfigEditor&parent=Settings&view=Detail&block=' . $menuItem->get('blockid') . '&fieldid=' . $menuItem->get('fieldid');

    Line exceeds 120 characters; contains 152 characters
    Open

            return 'index.php?module=ConfigEditor&parent=Settings&view=Detail&block=' . $menuItem->get('blockid') . '&fieldid=' . $menuItem->get('fieldid');

    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

                    $params['validator'] = [['name' => 'WholeNumberGreaterThanZero']];

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                    $params['picklistValues'] = \App\Layout::getAllLayouts();

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                    break;

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

                    // Realtion

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

                    $params['typeofdata'] = 'C~M';

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

                    unset($params['validator']);

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

         */

    Line exceeds 120 characters; contains 150 characters
    Open

            return 'index.php?module=ConfigEditor&parent=Settings&view=Edit&block=' . $menuItem->get('blockid') . '&fieldid=' . $menuItem->get('fieldid');

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

        {

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

         * Function determines fields available in edition view.

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

         * @param string $name

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

                    $params['maximumlength'] = (string) round(\App\Config::getMaxUploadSize(false, true), 0) ?: '';

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

                    break;

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

                case 'default_module':

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

                    $params['uitype'] = 16;

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

                        $params['picklistValues'][$module['name']] = \App\Language::translate($module['name'], $module['name']);

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

                    $params['label'] = $this->relationFields[$name];

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

                    $params['tooltip'] = 'LBL_RELATION_SEPARATE_CHANGE_RELATION_BUTTON_DESC';

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

            return Settings_Vtiger_MenuItem_Model::getInstance('LBL_CONFIG_EDITOR');

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

        {

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

         * @return self

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

        {

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

                    $params['uitype'] = 7;

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

                case 'upload_maxsize':

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

                case 'langInLoginView':

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

                case 'breadcrumbs':

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

                    unset($params['validator']);

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

                    $params['maximumlength'] = '50';

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

                    $params['source'] = 'relation';

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

                case 'separateChangeRelationButton':

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

                    $params['uitype'] = 1;

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

                    $params['isEditableReadOnly'] = !\App\YetiForce\Shop::check('YetiForceDisableBranding');

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

            return Settings_Vtiger_Field_Model::init($moduleName, $params);

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

            return $value;

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

         * @return menu item Model

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

         * @return string Url

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

         * Function to get the instance of Config module model.

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                    $params['purifyType'] = \App\Purifier::BOOL;

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

                    $params['uitype'] = 56;

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

                    $params['label'] = $this->listFields[$name];

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

                    $params['uitype'] = 7;

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

        public function getDisplayValue($name)

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

                case 'upload_maxsize':

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

         */

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

                    $params['validator'] = [['name' => 'WholeNumberGreaterThanZero']];

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                    $params['source'] = 'relation';

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

                    $params['purifyType'] = \App\Purifier::INTEGER;

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

                    $params['maximumlength'] = '255';

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

         * @return mixed

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

                    $value = $this->getFieldInstanceByName($name)->getDisplayValue($this->get($name));

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

        public function getMenuItem()

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

         * @return string Url

    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

                case 'MAX_NUMBER_EXPORT_RECORDS':

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

                    $params['maximumlength'] = '99999999';

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

                    break;

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

                    break;

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

                    $params['label'] = $this->listFields[$name];

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

                    $params['uitype'] = 56;

    Line exceeds 120 characters; contains 124 characters
    Open

                        $params['picklistValues'][$module['name']] = \App\Language::translate($module['name'], $module['name']);

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

                    $params['fieldvalue'] = $this->get($name);

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

                case 'title_max_length':

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

                case 'MINIMUM_CRON_FREQUENCY':

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

                    break;

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

                    $params['purifyType'] = \App\Purifier::URL;

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

                    unset($params['validator']);

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

            }

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

                    break;

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

        /**

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

        public function getEditViewUrl()

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

         * Function to get Detail view Url.

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

        }

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                case 'defaultLayout':

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

                    $params['uitype'] = 16;

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

                    break;

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

                    $params['label'] = $this->relationFields[$name];

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

                    // Branding

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

                case 'footerName':

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

                case 'urlTwitter':

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

                    $params['fieldvalue'] = $defaullt === $this->get($name) ? '' : $this->get($name);

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

        }

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

        public function getFieldInstanceByName($name)

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

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

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

            switch ($name) {

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

                    $params['typeofdata'] = 'C~M';

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

                    break;

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

                case 'COMMENT_MAX_LENGTH':

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

                case 'SHOW_RELATED_ICON':

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

                    $params['uitype'] = 56;

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

                    $params['source'] = 'relation';

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

                    $params['fieldvalue'] = $this->get($name);

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

                    $params['uitype'] = 7;

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

                    $params['typeofdata'] = 'V~O';

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                    $params['source'] = 'component:Branding';

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

                case 'urlLinkedIn':

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

                    $config = new \App\ConfigFile('component', 'Branding');

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

                    break;

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

                default:

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

            }

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

            $menuItem = $this->getMenuItem();

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

         * @return \Settings_Vtiger_Field_Model

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

                    $params['source'] = 'performance';

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

                case 'listMaxEntriesMassEdit':

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

                    $params['label'] = $this->listFields[$name];

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

                    break;

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

                case 'SHOW_RECORDS_COUNT':

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

                    unset($params['validator']);

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

                    break;

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

                    $params['label'] = $this->relationFields[$name];

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

                case 'listview_max_textlength':

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

                case 'urlFacebook':

    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

         * @throws \ReflectionException

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

                    $params['maximumlength'] = '5000';

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

                    $params['typeofdata'] = 'C~M';

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

                    break;

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

                    $params['purifyType'] = \App\Purifier::BOOL;

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

                    $params['maximumlength'] = '255';

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

                    $defaullt = $config->getTemplate($name)['default'];

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

                    $params['source'] = 'component:Branding';

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

                    break;

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

         * @param string $name field name

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

         */

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

                    $params['label'] = $this->performanceFields[$name];

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

                    $params['label'] = $this->listFields[$name];

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

                    unset($params['validator']);

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

                    $params['purifyType'] = \App\Purifier::BOOL;

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

                    }

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

                    $params['label'] = $this->listFields[$name];

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

                    $params['maximumlength'] = '200';

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

                    break;

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

        /**

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

         * Function to getDisplay value of every field.

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

            switch ($name) {

    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

         *

    Line exceeds 120 characters; contains 252 characters
    Open

            $params = ['uitype' => 7, 'column' => $name, 'name' => $name,  'displaytype' => 1, 'typeofdata' => 'I~M', 'presence' => 0, 'isEditableReadOnly' => false, 'maximumlength' => '', 'validator' => [['name' => 'NumberRange100']], 'source' => 'main'];

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

                case 'backgroundClosingModal':

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

                    unset($params['validator']);

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

                    foreach (\vtlib\Functions::getAllModules(true, false, 0) as $module) {

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

                    $params['tooltip'] = 'LBL_RELATION_COMMENT_MAX_LENGTH_DESC';

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

                    $params['label'] = $this->brandingFields[$name];

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

                    $params['label'] = $this->brandingFields[$name];

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

                    $params['typeofdata'] = 'V~O';

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

        {

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

                    $value = $this->get($name) . ' ' . \App\Language::translate('LBL_MB', $this->getName(true));

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

         * @param mixed $name

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

                    $params['source'] = 'layout';

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

                    $params['uitype'] = 56;

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

                    $params['purifyType'] = \App\Purifier::TEXT;

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

         *

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

        public static function getInstance($name = 'Settings:Vtiger')

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

            return new self();

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

            $moduleName = $this->getName(true);

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

                    $params['label'] = $this->listFields[$name];

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

                case 'layoutInLoginView':

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

                    break;

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

                case 'href_max_length':

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

                    break;

    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

                    $params['uitype'] = 17;

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

                    $params['fieldvalue'] = $this->get($name);

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

                default:

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

        }

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

                case 'list_max_entries_per_page':

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

                    break;

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

        }

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

                    unset($params['validator']);

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

                    $params['maximumlength'] = '255';

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

                    $params['isEditableReadOnly'] = !\App\YetiForce\Shop::check('YetiForceDisableBranding');

    Class name "Settings_ConfigEditor_Module_Model" is not in camel caps format
    Open

    class Settings_ConfigEditor_Module_Model extends Settings_Vtiger_Module_Model

    There are no issues that match your filters.

    Category
    Status