YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/AdvancedPermission/models/Record.php

Summary

Maintainability
C
7 hrs
Test Coverage
F
38%

Function getDisplayValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDisplayValue(string $key)
    {
        $value = $this->get($key);
        switch ($key) {
            case 'tabid':
Severity: Minor
Found in modules/Settings/AdvancedPermission/models/Record.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

Method getDisplayValue has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getDisplayValue(string $key)
    {
        $value = $this->get($key);
        switch ($key) {
            case 'tabid':
Severity: Major
Found in modules/Settings/AdvancedPermission/models/Record.php - About 2 hrs to fix

    Function save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save()
        {
            $db = \App\Db::getInstance('admin');
            $recordId = $this->getId();
    
    
    Severity: Minor
    Found in modules/Settings/AdvancedPermission/models/Record.php - About 45 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 getDisplayValue() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10.
    Open

        public function getDisplayValue(string $key)
        {
            $value = $this->get($key);
            switch ($key) {
                case 'tabid':

    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

    Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
    Open

        public function getDisplayValue(string $key)

    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

    See

    Avoid using undefined variables such as '$action' which will lead to PHP notices.
    Open

                        $value = Settings_AdvancedPermission_Module_Model::$action[$value];

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$priority' which will lead to PHP notices.
    Open

                    if (isset(Settings_AdvancedPermission_Module_Model::$priority[$value])) {

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$status' which will lead to PHP notices.
    Open

                        $value = Settings_AdvancedPermission_Module_Model::$status[$value];

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$priority' which will lead to PHP notices.
    Open

                        $value = Settings_AdvancedPermission_Module_Model::$priority[$value];

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$action' which will lead to PHP notices.
    Open

                    if (isset(Settings_AdvancedPermission_Module_Model::$action[$value])) {

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$status' which will lead to PHP notices.
    Open

                    if (isset(Settings_AdvancedPermission_Module_Model::$status[$value])) {

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    The class Settings_AdvancedPermission_Record_Model has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13.
    Open

    class Settings_AdvancedPermission_Record_Model extends Settings_Vtiger_Record_Model
    {
        /**
         * Function to get the Id.
         *

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    The method getEditViewUrl has a boolean flag argument $step, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getEditViewUrl($step = false)

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Missing class import via use statement (line '68', column '17').
    Open

            $query = (new \App\Db\Query())->from('a_#__adv_permission')->where(['id' => $id]);

    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\Json' in method 'getInstance'.
    Open

                $row['conditions'] = \App\Json::decode($row['conditions']);

    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\Fields\Owner' in method 'getUserByMember'.
    Open

                $user = \App\Fields\Owner::getUserLabel($id);

    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\Db' in method 'save'.
    Open

            $db = \App\Db::getInstance('admin');

    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\Module' in method 'delete'.
    Open

                    \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

    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 save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $db->createCommand()->update('a_#__adv_permission', $params, ['id' => $recordId])->execute();
            }

    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\Privilege' in method 'save'.
    Open

                \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

    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\Purifier' in method 'getDisplayValue'.
    Open

                    $value = \App\Purifier::encodeHtml($value);

    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 'Vtiger_Link_Model' in method 'getRecordLinks'.
    Open

                $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

    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

                                    $name = \App\Language::translate($roleInfo['rolename']);

    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\PrivilegeAdvanced' in method 'delete'.
    Open

                \App\PrivilegeAdvanced::reloadCache();

    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\Json' in method 'getInstance'.
    Open

                $row['members'] = \App\Json::decode($row['members']);

    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\Json' in method 'save'.
    Open

                $params['members'] = \App\Json::encode($params['members']);

    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\Fields\Owner' in method 'getDisplayValue'.
    Open

                                    $name = \App\Fields\Owner::getUserLabel($id);

    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\Privilege' in method 'delete'.
    Open

                    \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

    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\PrivilegeAdvanced' in method 'save'.
    Open

            \App\PrivilegeAdvanced::reloadCache();

    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\Json' in method 'save'.
    Open

                $params['conditions'] = \App\Json::encode($params['conditions']);

    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\Module' in method 'getDisplayValue'.
    Open

                    $value = \App\Module::getModuleName($value);

    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

                                    $name = \App\Language::translate($roleInfo['rolename']);

    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\PrivilegeUtil' in method 'getDisplayValue'.
    Open

                                    $roleInfo = \App\PrivilegeUtil::getRoleDetail($id);

    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

                                    $name = \App\Language::translate(\App\Fields\Owner::getGroupName($id));

    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\Fields\Owner' in method 'getDisplayValue'.
    Open

                                    $name = \App\Language::translate(\App\Fields\Owner::getGroupName($id));

    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\PrivilegeUtil' in method 'getDisplayValue'.
    Open

                                    $roleInfo = \App\PrivilegeUtil::getRoleDetail($id);

    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

                            $values[] = \App\Language::translate($type) . ': ' . $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\PrivilegeUtil' in method 'getUserByMember'.
    Open

                    $users = array_merge($users, \App\PrivilegeUtil::getUserByMember($member));

    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\Db' in method 'getInstance'.
    Open

            $db = \App\Db::getInstance('admin');

    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\Module' in method 'save'.
    Open

                \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

    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 "a_#__adv_permission" 4 times.
    Open

            $query = (new \App\Db\Query())->from('a_#__adv_permission')->where(['id' => $id]);

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

                $row['conditions'] = \App\Json::decode($row['conditions']);

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

            $db = \App\Db::getInstance('admin');

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

                \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

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

                $row['members'] = \App\Json::decode($row['members']);

    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.

    Return type of getInstance() is undeclared type \self
    Open

        public static function getInstance($id)

    Call to undeclared method \App\Db\Query::from
    Open

            $query = (new \App\Db\Query())->from('a_#__adv_permission')->where(['id' => $id]);

    Call to method getGroupName from undeclared class \App\Fields\Owner
    Open

                                    $name = \App\Language::translate(\App\Fields\Owner::getGroupName($id));

    Call to method getUserLabel from undeclared class \App\Fields\Owner
    Open

                $user = \App\Fields\Owner::getUserLabel($id);

    Call to method getUserLabel from undeclared class \App\Fields\Owner
    Open

                                    $name = \App\Fields\Owner::getUserLabel($id);

    Call to undeclared method \App\Db::createCommand
    Open

            $delete = \App\Db::getInstance('admin')->createCommand()

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->insert('a_#__adv_permission', $params)->execute();

    Call to undeclared method \App\Db::createCommand
    Open

                $db->createCommand()->update('a_#__adv_permission', $params, ['id' => $recordId])->execute();

    This case's code block is the same as the block for the case on line 153.
    Open

                                case 'RoleAndSubordinates':
                                    $roleInfo = \App\PrivilegeUtil::getRoleDetail($id);
                                    $name = \App\Language::translate($roleInfo['rolename']);
                                    break;

    Having two cases in a switch statement or two branches in an if chain with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then in an if chain they should be combined, or for a switch, one should fall through to the other.

    Noncompliant Code Example

    switch ($i) {
      case 1:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      case 3:  // Noncompliant; duplicates case 1's implementation
        doSomething();
        break;
      default:
        doTheRest();
    }
    
    if ($a >= 0 && $a < 10) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else if ($a >= 20 && $a < 50) {
      doTheThing();  // Noncompliant; duplicates first condition
    }
    else {
      doTheRest();
    }
    
    if ($b == 0) {
      doOneMoreThing();
    }
    else {
      doOneMoreThing(); // Noncompliant; duplicates then-branch
    }
    
    var b = a ? 12 > 4 : 4;  // Noncompliant; always results in the same value
    

    Compliant Solution

    switch ($i) {
      case 1:
      case 3:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      default:
        doTheRest();
    }
    
    if (($a >= 0 && $a < 10) || ($a >= 20 && $a < 50)) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else {
      doTheRest();
    }
    
    doOneMoreThing();
    
    b = 4;
    

    or

    switch ($i) {
      case 1:
        doSomething();
        break;
      case 2:
        doSomethingDifferent();
        break;
      case 3:
        doThirdThing();
        break;
      default:
        doTheRest();
    }
    
    if ($a >= 0 && $a < 10) {
      doTheThing();
    else if ($a >= 10 && $a < 20) {
      doTheOtherThing();
    }
    else if ($a >= 20 && $a < 50) {
      doTheThirdThing();
    }
    else {
      doTheRest();
    }
    
    if ($b == 0) {
      doOneMoreThing();
    }
    else {
      doTheRest();
    }
    
    int b = a ? 12 > 4 : 8;
    

    Exceptions

    Blocks in an if chain that contain a single line of code are ignored, as are blocks in a switch statement that contain a single line of code with or without a following break.

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

        public function getRecordLinks(): array
        {
            $links = [];
            $recordLinks = [
                [
    Severity: Major
    Found in modules/Settings/AdvancedPermission/models/Record.php and 1 other location - About 1 hr to fix
    modules/Settings/MailSmtp/models/Record.php on lines 67..90

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

    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

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

    class Settings_AdvancedPermission_Record_Model extends Settings_Vtiger_Record_Model

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = \App\Db::getInstance('admin');

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    The class Settings_AdvancedPermission_Record_Model is not named in CamelCase.
    Open

    class Settings_AdvancedPermission_Record_Model extends Settings_Vtiger_Record_Model
    {
        /**
         * Function to get the Id.
         *

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

                            [$type, $id] = explode(':', $member);

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = \App\Db::getInstance('admin');

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

        public static function getInstance($id)

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

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

        }

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

            $instance = false;

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

                $row['members'] = \App\Json::decode($row['members']);

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

        public function save()

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

                if ($this->has($key)) {

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

                $db->createCommand()->insert('a_#__adv_permission', $params)->execute();

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

            switch ($key) {

    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 'members':

    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($id)

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

            if (!$recordId) {

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

                case 'action':

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

                case 'priority':

    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 $step

    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

                        $value = Settings_AdvancedPermission_Module_Model::$status[$value];

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

            return $this->get('id');

    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

         */

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

            if ($this->has('conditions')) {

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

        public function getDisplayValue(string $key)

    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 instance, if exists

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

            $query = (new \App\Db\Query())->from('a_#__adv_permission')->where(['id' => $id]);

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

            if (false !== $row) {

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

                $params['conditions'] = \App\Json::encode($params['conditions']);

    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($step = false)

    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

            return $instance;

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

        }

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

            if (isset($params['conditions'])) {

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

            if (isset($params['members'])) {

    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

                    if (isset(Settings_AdvancedPermission_Module_Model::$status[$value])) {

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

                        $value = Settings_AdvancedPermission_Module_Model::$priority[$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

        {

    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

                    $value = \App\Module::getModuleName($value);

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

                case 'status':

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

        /**

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

            $db = \App\Db::getInstance('admin');

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

            $recordId = $this->getId();

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

                    $params[$key] = $value;

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

            \App\PrivilegeAdvanced::reloadCache();

    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

        /**

    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

         * @return string URL

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

            foreach ($this->getData() as $key => $value) {

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

                        $value = Settings_AdvancedPermission_Module_Model::$action[$value];

    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

            return $this->get('name');

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

         * Function to get the Detail 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

                }

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

                $db->createCommand()->update('a_#__adv_permission', $params, ['id' => $recordId])->execute();

    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

         * @param string $key

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

            $value = $this->get($key);

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

    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 'tabid':

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

                    if (isset(Settings_AdvancedPermission_Module_Model::$action[$value])) {

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

        public function getId()

    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

                $this->set('id', $db->getLastInsertID('a_#__adv_permission_id_seq'));

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

                    if (isset(Settings_AdvancedPermission_Module_Model::$priority[$value])) {

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

                                case 'Roles':

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

                                    $name = \App\Language::translate($roleInfo['rolename']);

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

        /**

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

            if ($delete) {

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

            $members = $this->get('members');

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

                foreach ($members as &$member) {

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

        }

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

                            [$type, $id] = explode(':', $member);

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

                                case 'RoleAndSubordinates':

    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

                \App\PrivilegeAdvanced::reloadCache();

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

        }

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

            if (!empty($members)) {

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

         * Function to get the Id.

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

         * @return string

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

            $mode = '';

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

            return '?module=AdvancedPermission&parent=Settings&view=Detail&record=' . $this->getId();

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

         * Function to get the instance of advanced permission record model.

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

         * @param int $id

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

                $row['conditions'] = \App\Json::decode($row['conditions']);

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

                $params['members'] = \App\Json::encode($params['members']);

    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

                        foreach ($value as $member) {

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

                \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

    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 delete the current Record Model.

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

                    if (!empty($value)) {

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

            $delete = \App\Db::getInstance('admin')->createCommand()

    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

                    'linkurl' => $this->getEditViewUrl(),

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

                    'linkicon' => 'yfi yfi-full-editing-view',

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

                    'linkclass' => 'btn btn-danger btn-sm',

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

         * @return int Id

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

                    'linkicon' => 'fas fa-trash-alt',

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

                $mode = '&mode=step' . $step;

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

            return '?module=AdvancedPermission&parent=Settings&view=Edit&record=' . $this->getId() . $mode;

    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

            $row = $query->createCommand($db)->queryOne();

    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

                    }

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

         * Function to get the Edit View Url.

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

                $instance = new 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

         */

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

            $db = \App\Db::getInstance('admin');

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

            $params = [];

    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 get the Display Value, for the current field type with given DB Insert Value.

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

         * @return string

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

                            switch ($type) {

    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 'Groups':

    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

                $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

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

            return $links;

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

         *

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

                $users = array_unique($users);

    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 get the Name.

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

        public function getName()

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

         *

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

            if (false !== $step) {

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

                $instance->setData($row);

    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

                                    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

                    \App\Privilege::setUpdater(\App\Module::getModuleName($this->get('tabid')));

    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 getUserByMember()

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

            }

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

                        $values = [];

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

            $recordLinks = [

    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 'Users':

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

                                    $name = \App\Language::translate(\App\Fields\Owner::getGroupName($id));

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

                        }

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

                            $values[] = \App\Language::translate($type) . ': ' . $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

                    'linktype' => 'LISTVIEWRECORD',

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

        {

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

                ->delete('a_#__adv_permission', ['id' => $this->getId()])

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

                if ($this->has('conditions')) {

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

            return $delete;

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

                    'linktype' => 'LISTVIEWRECORD',

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

                    'linklabel' => 'LBL_EDIT_RECORD',

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

            }

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

            $links = [];

    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

         * Function to retrieve a list of users.

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

                $user = \App\Fields\Owner::getUserLabel($id);

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

                        $value = implode(', ', $values);

    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

         *

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

        public function getRecordLinks(): array

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

            foreach ($recordLinks as $recordLink) {

    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

            foreach ($users as $id => &$user) {

    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

                                    $roleInfo = \App\PrivilegeUtil::getRoleDetail($id);

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

         * @return bool

    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

                    'linkurl' => "javascript:Settings_Vtiger_List_Js.deleteById('{$this->getId()}')",

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

            $users = [];

    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 $users;

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

                                    $name = \App\Language::translate($roleInfo['rolename']);

    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

                    'linklabel' => 'LBL_DELETE_RECORD',

    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 = \App\Purifier::encodeHtml($value);

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

                                    $name = \App\Fields\Owner::getUserLabel($id);

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

        public function delete(): bool

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

                ->execute();

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

                                    $roleInfo = \App\PrivilegeUtil::getRoleDetail($id);

    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

                    'linkclass' => 'btn btn-primary btn-sm',

    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

            $users = array_flip($users);

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

                [

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

                    $users = array_merge($users, \App\PrivilegeUtil::getUserByMember($member));

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

    class Settings_AdvancedPermission_Record_Model extends Settings_Vtiger_Record_Model

    There are no issues that match your filters.

    Category
    Status