YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
D
2 days
Test Coverage
D
60%

File Record.php has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/* +***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
Severity: Minor
Found in modules/Settings/Roles/models/Record.php - About 5 hrs to fix

    Method save has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function save()
        {
            $db = App\Db::getInstance();
            $roleId = $this->getId();
            $mode = 'edit';
    Severity: Major
    Found in modules/Settings/Roles/models/Record.php - About 3 hrs to fix

      The class Settings_Roles_Record_Model has an overall complexity of 75 which is very high. The configured complexity threshold is 50.
      Open

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

      Settings_Roles_Record_Model has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Settings_Roles_Record_Model extends Settings_Vtiger_Record_Model
      {
          /**
           * Function to get the Id.
           *
      Severity: Minor
      Found in modules/Settings/Roles/models/Record.php - About 3 hrs to fix

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

            public function save()
            {
                $db = App\Db::getInstance();
                $roleId = $this->getId();
                $mode = 'edit';
        Severity: Minor
        Found in modules/Settings/Roles/models/Record.php - About 3 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 delete has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function delete($transferToRole)
            {
                $db = App\Db::getInstance();
                $roleId = $this->getId();
                $transferRoleId = $transferToRole->getId();
        Severity: Minor
        Found in modules/Settings/Roles/models/Record.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                      if ($rolePreviousData['listrelatedrecord'] != $this->get('listrelatedrecord')
                              || $rolePreviousData['previewrelatedrecord'] != $this->get('previewrelatedrecord')
                              || $rolePreviousData['editrelatedrecord'] != $this->get('editrelatedrecord')
                              || $rolePreviousData['permissionsrelatedfield'] != $permissionsRelatedField
                              || $rolePreviousData['searchunpriv'] != $searchunpriv
          Severity: Major
          Found in modules/Settings/Roles/models/Record.php - About 1 hr to fix

            Function getSameLevelRoles has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getSameLevelRoles()
                {
                    if (!isset($this->children)) {
                        $parentRoles = \App\PrivilegeUtil::getParentRole($this->getId());
                        $currentRoleDepth = $this->getDepth();
            Severity: Minor
            Found in modules/Settings/Roles/models/Record.php - About 55 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 save() has an NPath complexity of 18432. The configured NPath complexity threshold is 200.
            Open

                public function save()
                {
                    $db = App\Db::getInstance();
                    $roleId = $this->getId();
                    $mode = 'edit';

            NPathComplexity

            Since: 0.1

            The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

            Example

            class Foo {
                function bar() {
                    // lots of complicated code
                }
            }

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

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

                public function save()
                {
                    $db = App\Db::getInstance();
                    $roleId = $this->getId();
                    $mode = 'edit';

            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

            Class "Settings_Roles_Record_Model" has 27 methods, which is greater than 20 authorized. Split it into smaller classes.
            Open

            class Settings_Roles_Record_Model extends Settings_Vtiger_Record_Model

            A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

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

                public function save()

            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

            Missing class import via use statement (line '346', column '25').
            Open

                        $insertedData = (new App\Db\Query())

            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

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

                    $query = (new App\Db\Query())->from('vtiger_role');

            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

            Missing class import via use statement (line '155', column '22').
            Open

                    $dataReader = (new App\Db\Query())->from('vtiger_role')

            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

            Missing class import via use statement (line '176', column '15').
            Open

                    return (new App\Db\Query())->select(['profileid'])->from('vtiger_role2profile')->where(['roleid' => $this->getId()])->column();

            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

            Missing class import via use statement (line '552', column '15').
            Open

                    return (new App\Db\Query())->select(['userid'])

            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

            Missing class import via use statement (line '580', column '15').
            Open

                    return (new App\Db\Query())->select(['multicompanyid', 'company_name'])

            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

            Missing class import via use statement (line '102', column '23').
            Open

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')

            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

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

                    $query = (new App\Db\Query())->from('vtiger_role')->where(['rolename' => $name]);

            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

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

                            ->select([new \yii\db\Expression($db->quoteValue($roleId)), 'picklistvalueid', 'picklistid', 'sortid'])

            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

            Missing class import via use statement (line '513', column '15').
            Open

                    $row = (new App\Db\Query())->from('vtiger_role')->where(['depth' => 0])->one();

            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

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

                public static function getAll($baseRole = 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 '131', column '23').
            Open

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')

            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

            Missing class import via use statement (line '190', column '15').
            Open

                    $row = (new App\Db\Query())->select(['directly_related_to_role', 'vtiger_profile.profileid'])

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

                            \App\Privilege::setAllUpdater();

            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::setAllUpdater();

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

                        } else {
                            $this->parent = null;
                        }

            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 'Settings_Profiles_Record_Model' in method 'getProfiles'.
            Open

                        $this->profiles = Settings_Profiles_Record_Model::getAllByRole($this->getId());

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

                    \App\Cache::delete('getCompanyRoles', '');

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

                        \App\Cache::delete('getUsersByCompany', $rolePreviousData['company']);

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

                    \App\Cache::delete('RoleDetail', $roleId);

            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 {
                        $values['roleid'] = $roleId;
                        $db->createCommand()->insert('vtiger_role', $values)->execute();
                        $insertedData = (new App\Db\Query())
                            ->select([new \yii\db\Expression($db->quoteValue($roleId)), 'picklistvalueid', 'picklistid', 'sortid'])

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

                    \App\Cache::delete('getUsersByCompany', '');

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

                        \App\Cache::delete('getUsersByCompany', $this->get('company'));

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

                            \App\UserPrivilegesFile::createUserPrivilegesfile($userid);

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

                    \App\Cache::delete(__CLASS__, $roleId);

            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 'delete'.
            Open

                    \App\PrivilegeUtil::deleteRelatedSharingRules($roleId, 'Roles');

            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\Cache' in method 'getInstanceById'.
            Open

                    return \App\Cache::staticGet(__CLASS__, $roleId);

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

                            } else {
                                $parentRoleString = $parentRoleString . '::' . $role;
                            }

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

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

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

                        $rolePreviousData = App\PrivilegeUtil::getRoleDetail($roleId);

            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\Cache' in method 'getInstanceById'.
            Open

                    if (!\App\Cache::staticHas(__CLASS__, $roleId)) {

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

                            \App\UserPrivilegesFile::createUserSharingPrivilegesfile($userid);

            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 'getInstanceById'.
            Open

                        $row = \App\PrivilegeUtil::getRoleDetail($roleId);

            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\Cache' in method 'getInstanceById'.
            Open

                        \App\Cache::staticSave(__CLASS__, $roleId, $instance);

            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 'getSameLevelRoles'.
            Open

                        $parentRoles = \App\PrivilegeUtil::getParentRole($this->getId());

            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 'Users_Record_Model' in method 'getUsers'.
            Open

                        $usersList[$userId] = Users_Record_Model::getInstanceById($userId, 'Users');

            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 'delete'.
            Open

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

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

                        'previewrelatedrecord' => $this->get('previewrelatedrecord'),

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

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

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

            ACTION_1 = 'action1';
            
            function run() {
              prepare(ACTION_1);
              execute(ACTION_1);
              release(ACTION_1);
            }
            

            Exceptions

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

            Define a constant instead of duplicating this literal "vtiger_role" 10 times.
            Open

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')

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

                    $this->set('allowassignedrecordsto', $this->get('allowassignedrecordsto'));

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

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

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

                    return (new App\Db\Query())->select(['profileid'])->from('vtiger_role2profile')->where(['roleid' => $this->getId()])->column();

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

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

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

                        'company' => (int) $this->get('company'),

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

                        'listrelatedrecord' => $this->get('listrelatedrecord'),

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

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

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

            ACTION_1 = 'action1';
            
            function run() {
              prepare(ACTION_1);
              execute(ACTION_1);
              release(ACTION_1);
            }
            

            Exceptions

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

            Define a constant instead of duplicating this literal "vtiger_role2profile" 5 times.
            Open

                    return (new App\Db\Query())->select(['profileid'])->from('vtiger_role2profile')->where(['roleid' => $this->getId()])->column();

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

                    \App\Cache::delete('getUsersByCompany', '');

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

                    $permissionsRelatedField = $this->get('permissionsrelatedfield');

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

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

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

                        'editrelatedrecord' => (int) $this->get('editrelatedrecord'),

            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.

            Saw unextractable annotation for comment '* @return <array> - List of Settings_Roles_Record_Model instances'</array>
            Open

                 * @return <Array> - List of Settings_Roles_Record_Model instances

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

                    $db->createCommand()->delete('vtiger_role', ['roleid' => $roleId])->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Argument 2 (key) is int but \App\Cache::staticSave() takes string defined at /code/app/Cache.php:156
            Open

                        \App\Cache::staticSave(__CLASS__, $roleId, $instance);

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

                    return (new App\Db\Query())->select(['multicompanyid', 'company_name'])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Reference to undeclared property \Settings_Roles_Record_Model->parent
            Open

                    return $this->parent;

            Reference to undeclared property \Settings_Roles_Record_Model->profiles
            Open

                    if (!isset($this->profiles)) {

            Call to method __construct from undeclared class \yii\db\Expression
            Open

                            ->select([new \yii\db\Expression($db->quoteValue($roleId)), 'picklistvalueid', 'picklistid', 'sortid'])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                            $db->createCommand()->delete('vtiger_role2profile', ['roleid' => $roleId])->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Argument 2 (key) is int but \App\Cache::staticHas() takes string defined at /code/app/Cache.php:141
            Open

                    if (!\App\Cache::staticHas(__CLASS__, $roleId)) {

            Returning type null but getBaseRole() is declared to return \Settings_Roles_Record_Model
            Open

                    return null;

            Parameter $name has undeclared type \type
            Open

                public static function getInstanceByName($name, $excludedRecordId = [])

            Reference to undeclared property \Settings_Roles_Record_Model->parent
            Open

                    $this->parent = $parentRole;

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

                    $db->createCommand()->update('vtiger_user2role', ['roleid' => $transferRoleId], ['roleid' => $roleId])->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                    $row = (new App\Db\Query())->select(['directly_related_to_role', 'vtiger_profile.profileid'])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                        $db->createCommand()->insert('vtiger_role', $values)->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                    $db->createCommand()->delete('vtiger_group2role', ['roleid' => $roleId])->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Saw a token Phan may have failed to parse after '* @return null/role instance': after null, saw '/'
            Open

                 * @return null/role instance

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

                                $db->createCommand()->insert('vtiger_role2profile', ['roleid' => $roleId, 'profileid' => $profileIds[$i]])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Saw unextractable annotation for comment '* @return <number> Role Id'</number>
            Open

                 * @return <Number> Role Id

            Reference to undeclared property \Settings_Roles_Record_Model->children
            Open

                    return $this->children;

            Returning type false but getDirectlyRelatedProfileId() is declared to return \id
            Open

                    return false;

            Saw unextractable annotation for comment '* @return <array> Settings_Profiles_Record_Model instances'</array>
            Open

                 * @return <Array> Settings_Profiles_Record_Model instances

            Saw unextractable annotation for comment '* @param <settings_roles_record_model> $transferToRole'</settings_roles_record_model>
            Open

                 * @param <Settings_Roles_Record_Model> $transferToRole

            Argument 1 (roleId) is string but \Settings_Roles_Record_Model::getInstanceById() takes int defined at /code/modules/Settings/Roles/models/Record.php:493
            Open

                            $this->parent = self::getInstanceById($parentComponents[$noOfRoles - 2]);

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

                    $db->createCommand()->delete('vtiger_role2profile', ['roleid' => $roleId])->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Argument 2 (key) is int but \App\Cache::staticGet() takes string defined at /code/app/Cache.php:128
            Open

                    return \App\Cache::staticGet(__CLASS__, $roleId);

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

                    $row = (new App\Db\Query())->from('vtiger_role')->where(['depth' => 0])->one();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Reference to undeclared property \Settings_Roles_Record_Model->children
            Open

                        $this->children = $roles;

            Reference to undeclared property \Settings_Roles_Record_Model->children
            Open

                    return $this->children;

            Returning type false but getDirectlyRelatedProfileId() is declared to return \id
            Open

                        return false;

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

                            ->select([new \yii\db\Expression($db->quoteValue($roleId)), 'picklistvalueid', 'picklistid', 'sortid'])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                        $db->createCommand()->batchInsert('vtiger_role2picklist', ['roleid', 'picklistvalueid', 'picklistid', 'sortid'], $insertedData)->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                    $db->createCommand()->delete('vtiger_group2rs', ['roleandsubid' => $roleId])->execute();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Reference to undeclared property \Settings_Roles_Record_Model->parent
            Open

                    if (!isset($this->parent)) {

            Reference to undeclared property \Settings_Roles_Record_Model->parent
            Open

                            $this->parent = self::getInstanceById($parentComponents[$noOfRoles - 2]);

            Reference to undeclared property \Settings_Roles_Record_Model->children
            Open

                    if (!isset($this->children)) {

            Argument 1 (roleId) is int but \Settings_Profiles_Record_Model::getAllByRole() takes string defined at /code/modules/Settings/Profiles/models/Record.php:836
            Open

                        $this->profiles = Settings_Profiles_Record_Model::getAllByRole($this->getId());

            Reference to undeclared property \Settings_Roles_Record_Model->profiles
            Open

                        $this->profiles = Settings_Profiles_Record_Model::getAllByRole($this->getId());

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

                    $query = (new App\Db\Query())->from('vtiger_role');
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Saw unextractable annotation for comment '* @return <array> list of Role models <settings_roles_record_model>'</settings_roles_record_model></array>
            Open

                 * @return <Array> list of Role models <Settings_Roles_Record_Model>

            Reference to undeclared property \Settings_Roles_Record_Model->children
            Open

                    if (!isset($this->children)) {

            Saw unextractable annotation for comment '* @param <settings_roles_record_model> $newParentRole'</settings_roles_record_model>
            Open

                 * @param <Settings_Roles_Record_Model> $newParentRole

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

                    $query = (new App\Db\Query())->from('vtiger_role')->where(['rolename' => $name]);
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Saw unextractable annotation for comment '* @param <settings_roles_record_model> $role'</settings_roles_record_model>
            Open

                 * @param <Settings_Roles_Record_Model> $role

            Return type of getDirectlyRelatedProfileId() is undeclared type \id
            Open

                public function getDirectlyRelatedProfileId()

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

                        $db->createCommand()->update('vtiger_role', $values, ['roleid' => $roleId])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                    return (new App\Db\Query())->select(['userid'])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Saw unextractable annotation for comment '* @return <settings_roles_record_model> instance'</settings_roles_record_model>
            Open

                 * @return <Settings_Roles_Record_Model> instance

            Reference to undeclared property \Settings_Roles_Record_Model->parent
            Open

                            $this->parent = null;

            Reference to undeclared property \Settings_Roles_Record_Model->children
            Open

                        $this->children = $roles;

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

                    $dataReader = (new App\Db\Query())->from('vtiger_role')
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                    return (new App\Db\Query())->select(['profileid'])->from('vtiger_role2profile')->where(['roleid' => $this->getId()])->column();
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

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

                        $insertedData = (new App\Db\Query())
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Call to method getId on non-class type null
            Open

                            ->where(['roleid' => $parentRole->getId()])
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Saw unextractable annotation for comment '* @return <number>'</number>
            Open

                 * @return <Number>

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')
            Severity: Critical
            Found in modules/Settings/Roles/models/Record.php by phan

            Reference to undeclared property \Settings_Roles_Record_Model->profiles
            Open

                    return $this->profiles;

            Returning type \Settings_Roles_Record_Model but getInstanceByName() is declared to return null
            Open

                        return $instance;

            Saw unextractable annotation for comment '* @return <settings_roles_record_model> instance'</settings_roles_record_model>
            Open

                 * @return <Settings_Roles_Record_Model> instance

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

                    $currentParentRoleString = $this->getParentRoleString();

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                    $transferParentRoleSequence = $transferToRole->getParentRoleString();

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                        $oldChildParentRoleString = $roleModel->getParentRoleString();

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                        $oldChildParentRoleString = $roleModel->getParentRoleString();

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                        $newChildParentRoleString = str_replace($currentParentRoleSequence, $transferParentRoleSequence, $oldChildParentRoleString);

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                    $permissionsRelatedField = $this->get('permissionsrelatedfield');

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                        $newChildParentRoleString = str_replace($currentParentRoleString, $newParentRoleString, $oldChildParentRoleString);

            LongVariable

            Since: 0.2

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

            Example

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

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

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

                    $currentParentRoleSequence = $this->getParentRoleString();

            LongVariable

            Since: 0.2

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

            Example

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

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

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

            class Settings_Roles_Record_Model extends Settings_Vtiger_Record_Model

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

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

            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_Roles_Record_Model is not named in CamelCase.
            Open

            class Settings_Roles_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 $db. Configured minimum length is 3.
            Open

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

            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

                 */

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

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

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

                 * @return <Number> Role 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

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

                 * @return string

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

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

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

                 * Function to get Parent Role hierarchy as a string.

            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

                        if ($noOfRoles > 1) {

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

                            $this->parent = null;

            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

                        $parentRoleString = '';

            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

                        }

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

                 * Function to get all the children roles.

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

                 * Function returns profiles related to the current role.

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

                 * Function to get the profile id if profile is directly related to role.

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

                public function getDepth()

            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->parent = self::getInstanceById($parentComponents[$noOfRoles - 2]);

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

                        $currentRoleDepth = $this->getDepth();

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')

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

                            ->andWhere(['depth' => $currentRoleDepth + 1])

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

                                $parentRoleString = $parentRoleString . '::' . $role;

            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

                        while ($row = $dataReader->read()) {

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

                    if (!isset($this->children)) {

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

                        $this->children = $roles;

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

                 * @return array - profile ids

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

                 * @return <Array> - List of Settings_Roles_Record_Model instances

            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->children;

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

                            ->createCommand()->query();

            Line exceeds 120 characters; contains 135 characters
            Open

                    return (new App\Db\Query())->select(['profileid'])->from('vtiger_role2profile')->where(['roleid' => $this->getId()])->column();

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

                    return (new App\Db\Query())->select(['profileid'])->from('vtiger_role2profile')->where(['roleid' => $this->getId()])->column();

            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

                    $roleId = $this->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

                public function getParentRoleString()

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

                 *

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

                            ->where(['like', 'parentrole', $parentRoleString . '::%', false])

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

                            $roles[$role->getId()] = $role;

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

                            }

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

                        $dataReader->close();

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

                        ->where(['like', 'parentrole', $this->getParentRoleString() . '::%', false])

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

                        ->innerJoin('vtiger_profile', 'vtiger_profile.profileid = vtiger_role2profile.profileid')

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

                    return $this->get('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

                 * Function to get the depth of the role.

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

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

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

                    if (!isset($this->parent)) {

            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->children = $roles;

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

                            if (empty($parentRoleString)) {

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

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

                        ->createCommand()->query();

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

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

                 *

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

                        $parentComponents = explode('::', $parentRoleString);

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

                 */

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

                        $dataReader->close();

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

                    }

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

                        $currentRoleDepth = $this->getDepth();

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

                    $roles = [];

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

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

                        ->from('vtiger_role2profile')

            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 <Number>

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

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

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

                        $parentRoleString = $this->getParentRoleString();

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

                            ->createCommand()->query();

            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 false;

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

                    $row = (new App\Db\Query())->select(['directly_related_to_role', 'vtiger_profile.profileid'])

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

                        $noOfRoles = \count($parentComponents);

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

                    return $this->parent;

            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

                            ->andWhere(['depth' => $currentRoleDepth])

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

                        while ($row = $dataReader->read()) {

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

                            $role = 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

                        $roles[$role->getId()] = $role;

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

                    if (empty($roleId)) {

            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 immediate parent role.

            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

                            ->where(['like', 'parentrole', $parentRoleString . '::%', false])

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

                            $roles[$role->getId()] = $role;

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

                    return $this->children;

            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

                 * @param mixed $parentRole

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

                 * @return <Settings_Roles_Record_Model> instance

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

                public function setParent($parentRole)

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

                    $this->parent = $parentRole;

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

                public function getParent()

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

                {

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_role')

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

            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 set the immediate parent role.

            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

                        $roles = [];

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

                        foreach ($parentRoles as $role) {

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

                                $parentRoleString = $role;

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

                        $roles = [];

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

                        $role = 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

                {

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

                    if (!isset($this->children)) {

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

                        $parentRoles = \App\PrivilegeUtil::getParentRole($this->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

                 * @return 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

                 */

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

                 * @return Settings_Roles_Record_Model[] List of Settings_Roles_Record_Model instances

            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

                 *

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

                 * @return <Settings_Roles_Record_Model> instance

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

                        $parentRoleString = $this->getParentRoleString();

            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

                 * Function to get the immediate children roles.

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

                            $role = new self();

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

                public function getSameLevelRoles()

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

                    $dataReader = (new App\Db\Query())->from('vtiger_role')

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

                    while ($row = $dataReader->read()) {

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

                    $dataReader->close();

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

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

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

                            $role->setData($row);

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

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

                    if ($row && 1 === (int) $row['directly_related_to_role']) {

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

                 * Function to get the Edit View Url for the Role.

            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

                    $role->setParent($this);

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

                /**

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

                    $parentRole = $this->getParent();

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

                        'depth' => $this->getDepth(),

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

                        $insertedData = (new App\Db\Query())

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

                            ->select([new \yii\db\Expression($db->quoteValue($roleId)), 'picklistvalueid', 'picklistid', 'sortid'])

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

                    return 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 $this->profiles;

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

                    $this->set('allowassignedrecordsto', $this->get('allowassignedrecordsto'));

            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 (\is_array($permissionsRelatedField)) {

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

                        'parentrole' => $this->getParentRoleString(),

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

                        $values['roleid'] = $roleId;

            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 all the profiles associated with the current role.

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

                }

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

                    $currentDepth = $this->getDepth();

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

                        $oldChildParentRoleString = $roleModel->getParentRoleString();

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

                        $roleModel->set('parentrole', $newChildParentRoleString);

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

                    }

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

                            ->all();

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

                        ->where(['vtiger_role2profile.roleid' => $this->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

                    return '?module=Roles&parent=Settings&view=DeleteAjax&record=' . $this->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

                public function getProfiles()

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

                    return $role;

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

                }

            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

                        $searchunpriv = implode(',', $searchunpriv);

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

                        'allowassignedrecordsto' => $this->get('allowassignedrecordsto'),

            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

                    $allChildren = $this->getAllChildren();

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

                        $newChildDepth = $oldChildDepth + $depthDifference;

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

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

                    $mode = 'edit';

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

                    }

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

                        $rolePreviousData = App\PrivilegeUtil::getRoleDetail($roleId);

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

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

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

                    return '?module=Roles&parent=Settings&view=Edit&parent_roleid=' . $this->getId();

            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

                 * @return Settings_Roles_Record_Model instance

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

                 * Function to move the current role and all its children nodes to the new parent role.

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

                        $oldChildDepth = $roleModel->getDepth();

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

                        $roleId = 'H' . $roleIdNumber;

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

                        $permissionsRelatedField = implode(',', $permissionsRelatedField);

            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 add a child role to the current role.

            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 addChildRole($role)

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

                public function moveTo($newParentRole)

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

                    $this->set('depth', $newDepth);

            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

                    }

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

                        ->one();

            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 <Array> Settings_Profiles_Record_Model instances

            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 <Settings_Roles_Record_Model> $newParentRole

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

                {

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

                    $depthDifference = $newDepth - $currentDepth;

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

                    $this->set('parentrole', $newParentRoleString);

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

                        $roleModel->set('allowassignedrecordsto', $roleModel->get('allowassignedrecordsto'));

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

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

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

                        'changeowner' => (int) $this->get('changeowner'),

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

                        'editrelatedrecord' => (int) $this->get('editrelatedrecord'),

            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

                    }

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

                    return 'index.php?module=Roles&parent=Settings&view=Edit&record=' . $this->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

                }

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

                    $currentParentRoleString = $this->getParentRoleString();

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

                    $newParentRoleString = $newParentRole->getParentRoleString() . '::' . $this->getId();

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

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

                    $permissionsRelatedField = $this->get('permissionsrelatedfield');

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

                        'listrelatedrecord' => $this->get('listrelatedrecord'),

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

                        'permissionsrelatedfield' => $permissionsRelatedField,

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

                    if ('edit' === $mode) {

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

                        $db->createCommand()->insert('vtiger_role', $values)->execute();

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

                            ->from('vtiger_role2picklist')

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

                        return $row['profileid'];

            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

                 * Function to get the Create Child Role Url for the current role.

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

                public function getCreateChildUrl()

            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

                        $roleIdNumber = $db->getUniqueId('vtiger_role');

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

                        $this->set('depth', $parentRole->getDepth() + 1);

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

                        'assignedmultiowner' => $this->get('assignedmultiowner'),

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

                        'globalsearchadv' => (int) $this->get('globalsearchadv'),

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

                            ->where(['roleid' => $parentRole->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

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

                    foreach ($allChildren as $roleModel) {

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

                        $newChildParentRoleString = str_replace($currentParentRoleString, $newParentRoleString, $oldChildParentRoleString);

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

                    if (null !== $parentRole) {

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

                        'searchunpriv' => $searchunpriv,

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

                        $db->createCommand()->update('vtiger_role', $values, ['roleid' => $roleId])

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

                        $db->createCommand()->batchInsert('vtiger_role2picklist', ['roleid', 'picklistvalueid', 'picklistid', 'sortid'], $insertedData)->execute();

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

                        $this->set('roleid', $roleId);

            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

                /**

            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

                    $newDepth = $newParentRole->getDepth() + 1;

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

                 * Function to save the role.

            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

                 * Function to get the Delete Action Url for the current role.

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

                    if (!isset($this->profiles)) {

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

                        $this->profiles = Settings_Profiles_Record_Model::getAllByRole($this->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

                    $this->save();

            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

                /**

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

                        'rolename' => $this->getName(),

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

                        'clendarallorecords' => $this->get('clendarallorecords'),

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

                        'company' => (int) $this->get('company'),

            Line exceeds 120 characters; contains 151 characters
            Open

                        $db->createCommand()->batchInsert('vtiger_role2picklist', ['roleid', 'picklistvalueid', 'picklistid', 'sortid'], $insertedData)->execute();

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

                public function getDeleteActionUrl()

            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 <Settings_Roles_Record_Model> $role

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

                        $roleModel->set('depth', $newChildDepth);

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

                    $roleId = $this->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

                        $this->set('parentrole', $parentRole->getParentRoleString() . '::' . $roleId);

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

                    if (\is_array($searchunpriv)) {

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

                        'previewrelatedrecord' => $this->get('previewrelatedrecord'),

            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 127 characters
            Open

                        $newChildParentRoleString = str_replace($currentParentRoleString, $newParentRoleString, $oldChildParentRoleString);

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

                    $rolePreviousData = [];

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

                    if (empty($roleId)) {

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

                        'auto_assign' => (int) $this->get('auto_assign'),

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

                    if ($rolePreviousData) {

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

                                || $rolePreviousData['searchunpriv'] != $searchunpriv

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

                    $db->createCommand()->delete('vtiger_group2rs', ['roleandsubid' => $roleId])->execute();

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

                            \App\UserPrivilegesFile::createUserSharingPrivilegesfile($userid);

            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

                    $query = (new App\Db\Query())->from('vtiger_role');

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

                    if (!$baseRole) {

            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->get('company')) {

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

                        \App\Cache::delete('getUsersByCompany', $rolePreviousData['company']);

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

                        $oldChildParentRoleString = $roleModel->getParentRoleString();

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

                    if (\is_array($usersInRole)) {

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

                    if ($this->getParent()) {

            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 all the roles.

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

                        ->createCommand()->query();

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

                        $role = new self();

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

                            $db->createCommand()->delete('vtiger_role2profile', ['roleid' => $roleId])->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

                }

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

                    $roleId = $this->getId();

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

                    $db->createCommand()->update('vtiger_user2role', ['roleid' => $transferRoleId], ['roleid' => $roleId])->execute();

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

                    $currentParentRoleSequence = $this->getParentRoleString();

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

                    \App\Privilege::setAllUpdater();

            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

                        $roles[$role->getId()] = $role;

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

                        $instance = null;

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

            Line exceeds 120 characters; contains 122 characters
            Open

                    $db->createCommand()->update('vtiger_user2role', ['roleid' => $transferRoleId], ['roleid' => $roleId])->execute();

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

                    //delete handling for sharing rules

            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

                 * @return self|null

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

                 */

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

                            || ($profileIds && !empty(array_merge(array_diff($profileIds, $oldProfileIds), array_diff($oldProfileIds, $profileIds))))) {

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

                        \App\Cache::delete('getUsersByCompany', $this->get('company'));

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

                        foreach ($usersInRole as $userid) {

            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

                                'linktype' => 'LISTVIEWRECORD',

            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

                    while ($row = $dataReader->read()) {

            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

                            for ($i = 0; $i < $noOfProfiles; ++$i) {

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

                    \App\Cache::delete('getUsersByCompany', '');

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

                    $usersInRole = $this->getUsersIds();

            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

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

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

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

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

                 *

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

                    $dataReader = $query->orderBy(['parentrole' => SORT_DESC])

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

                public static function getInstanceById($roleId)

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

                 *

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

                                || $rolePreviousData['editrelatedrecord'] != $this->get('editrelatedrecord')

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

                    $db->createCommand()->delete('vtiger_role2profile', ['roleid' => $roleId])->execute();

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

                        $newChildDepth = \count(explode('::', $newChildParentRoleString)) - 1;

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

                public static function getAll($baseRole = 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

                        if ($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

                    if (!empty($profileIds)) {

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

                        if ($noOfProfiles > 0) {

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

                    \App\Cache::delete('RoleDetail', $roleId);

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

                    if (isset($rolePreviousData['company'])) {

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

                 * @param <Settings_Roles_Record_Model> $transferToRole

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

                        $roleModel->set('depth', $newChildDepth);

            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

                    }

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

                 * @return <Array> list of Role models <Settings_Roles_Record_Model>

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

                    $roles = [];

            Line exceeds 120 characters; contains 140 characters
            Open

                            || ($profileIds && !empty(array_merge(array_diff($profileIds, $oldProfileIds), array_diff($oldProfileIds, $profileIds))))) {

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

                            }

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

                    \App\Cache::delete('getCompanyRoles', '');

            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 delete($transferToRole)

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

                    $allChildren = $this->getAllChildren();

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

                            \App\UserPrivilegesFile::createUserPrivilegesfile($userid);

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

                    return $roles;

            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

                /**

            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

                    if (!\App\Cache::staticHas(__CLASS__, $roleId)) {

            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

                        $newChildParentRoleString = str_replace($currentParentRoleSequence, $transferParentRoleSequence, $oldChildParentRoleString);

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

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

                        $row = \App\PrivilegeUtil::getRoleDetail($roleId);

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

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

                        ->column();

            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

                    if ($row) {

            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

                 * Get multi company.

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

                        ->all();

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

                        $oldProfileIds = $this->getProfileIdList();

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

                        $noOfProfiles = \count($profileIds);

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

                    $db->createCommand()->delete('vtiger_group2role', ['roleid' => $roleId])->execute();

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

                    \App\PrivilegeUtil::deleteRelatedSharingRules($roleId, 'Roles');

            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 instance of Base Role model.

            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

                 * @param type  $name             -- name of the role

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

                    if ($row) {

            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

                        ->where(['roleid' => $this->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

                        if (!empty($profiles) && \count($profiles) > 0) {

            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

                    }

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

                        if ($rolePreviousData['listrelatedrecord'] != $this->get('listrelatedrecord')

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

                 */

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

                                || $rolePreviousData['previewrelatedrecord'] != $this->get('previewrelatedrecord')

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

                    $db->createCommand()->delete('vtiger_role', ['roleid' => $roleId])->execute();

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

                    $transferParentRoleSequence = $transferToRole->getParentRoleString();

            Line exceeds 120 characters; contains 136 characters
            Open

                        $newChildParentRoleString = str_replace($currentParentRoleSequence, $transferParentRoleSequence, $oldChildParentRoleString);

            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

                        foreach ($recordLinks as $recordLink) {

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

                 * @param int $roleId

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

                                || $rolePreviousData['permissionsrelatedfield'] != $permissionsRelatedField

            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

                            \App\Privilege::setAllUpdater();

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

                public function getMultiCompany()

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

                            $profileIds = array_keys($profiles);

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

                 * Function to delete the role.

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

                    foreach ($allChildren as $roleId => $roleModel) {

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

                }

            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

                    return $links;

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

                        $role->setData($row);

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

                    $dataReader->close();

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

                 * Function to get the instance of Role model, given role id.

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

                        \App\Cache::staticSave(__CLASS__, $roleId, $instance);

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

                    return \App\Cache::staticGet(__CLASS__, $roleId);

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

                    $row = (new App\Db\Query())->from('vtiger_role')->where(['depth' => 0])->one();

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

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

                 * @param mixed $excludedRecordId

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

                 * @return Users_Record_Model[] User record models list Users_Record_Model

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

                    if (empty($profileIds)) {

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

                        $profiles = $this->getProfiles();

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

                                $db->createCommand()->insert('vtiger_role2profile', ['roleid' => $roleId, 'profileid' => $profileIds[$i]])

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

                    $transferRoleId = $transferToRole->getId();

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

                        $roleModel->set('parentrole', $newChildParentRoleString);

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

                    }

            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

                                'linktype' => 'LISTVIEWRECORD',

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

                        $query->where(['<>', 'depth', 0]);

            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 instance of the role by Name.

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

                 * @return null/role 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

                {

            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 126 characters
            Open

                                $db->createCommand()->insert('vtiger_role2profile', ['roleid' => $roleId, 'profileid' => $profileIds[$i]])

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

                    \App\Cache::delete(__CLASS__, $roleId);

            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 bool $baseRole

            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 Settings_Roles_Record_Model instance, if exists. Null otherwise

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

                    return (new App\Db\Query())->select(['userid'])

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

                    return $usersList;

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

                 */

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

                    $usersList = [];

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

                        ->where(['mulcomp_status' => 'PLL_ACTIVE'])

            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

                public static function getInstanceByName($name, $excludedRecordId = [])

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

                    $row = $query->one();

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

                 * @return int[]

            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 (new App\Db\Query())->select(['multicompanyid', 'company_name'])

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

                        ->from('u_#__multicompany')

            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($excludedRecordId)) {

            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 Users who are from this role.

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

                        $usersList[$userId] = Users_Record_Model::getInstanceById($userId, 'Users');

            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

                public static function getBaseRole()

            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 null;

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

                public function getUsers()

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

                        $query->andWhere(['NOT IN', 'roleid', $excludedRecordId]);

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

                    foreach ($userIds as $userId) {

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

                    $query = (new App\Db\Query())->from('vtiger_role')->where(['rolename' => $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

                 * Function to get ids users in this role.

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

                        ->from('vtiger_user2role')

            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 null;

            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

                    $userIds = $this->getUsersIds();

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

            class Settings_Roles_Record_Model extends Settings_Vtiger_Record_Model

            There are no issues that match your filters.

            Category
            Status