YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
F
1 wk
Test Coverage
F
8%

Function saveModulePermissions has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

    protected function saveModulePermissions($moduleModel, $permissions)
    {
        $db = \App\Db::getInstance();
        $dbCommand = $db->createCommand();
        $profileId = $this->getId();
Severity: Minor
Found in modules/Settings/Profiles/models/Record.php - About 1 day 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

File Record.php has 672 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: Major
Found in modules/Settings/Profiles/models/Record.php - About 1 day to fix

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

        public function save()
        {
            $db = App\Db::getInstance();
            $profileName = $this->get('profilename');
            $description = $this->get('description');
    Severity: Minor
    Found in modules/Settings/Profiles/models/Record.php - About 7 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 saveModulePermissions has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function saveModulePermissions($moduleModel, $permissions)
        {
            $db = \App\Db::getInstance();
            $dbCommand = $db->createCommand();
            $profileId = $this->getId();
    Severity: Major
    Found in modules/Settings/Profiles/models/Record.php - About 4 hrs to fix

      Settings_Profiles_Record_Model has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
      {
          /**
           * Profile field inactive.
           *
      Severity: Minor
      Found in modules/Settings/Profiles/models/Record.php - About 4 hrs to fix

        Function getModulePermissions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getModulePermissions()
            {
                if (!isset($this->module_permissions)) {
                    $allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
                    $profileTabPermissions = $this->getProfileTabPermissions();
        Severity: Minor
        Found in modules/Settings/Profiles/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

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

        class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
        {
            /**
             * Profile field inactive.
             *

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

            public function save()
            {
                $db = App\Db::getInstance();
                $profileName = $this->get('profilename');
                $description = $this->get('description');
        Severity: Major
        Found in modules/Settings/Profiles/models/Record.php - About 3 hrs to fix

          Method getModulePermissions has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getModulePermissions()
              {
                  if (!isset($this->module_permissions)) {
                      $allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
                      $profileTabPermissions = $this->getProfileTabPermissions();
          Severity: Minor
          Found in modules/Settings/Profiles/models/Record.php - About 1 hr to fix

            Method getRecordLinks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getRecordLinks(): array
                {
                    $links = [];
            
                    $recordLinks = [
            Severity: Minor
            Found in modules/Settings/Profiles/models/Record.php - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if (!(
                              4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3])
                              || 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')
                              || 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')
                          )
              Severity: Major
              Found in modules/Settings/Profiles/models/Record.php - About 1 hr to fix

                Function hasModuleActionPermission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function hasModuleActionPermission($module, $action)
                    {
                        $actionId = false;
                        if (\is_object($action) && is_a($action, 'Vtiger_Action_Model')) {
                            $actionId = $action->getId();
                Severity: Minor
                Found in modules/Settings/Profiles/models/Record.php - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getProfileUtilityPermissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getProfileUtilityPermissions()
                    {
                        if (!isset($this->profile_utility_permissions)) {
                            $profile2UtilityPermissions = [];
                            if ($this->getId()) {
                Severity: Minor
                Found in modules/Settings/Profiles/models/Record.php - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getProfileActionPermissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getProfileActionPermissions()
                    {
                        if (!isset($this->profile_action_permissions)) {
                            $profile2ActionPermissions = [];
                            if ($this->getId()) {
                Severity: Minor
                Found in modules/Settings/Profiles/models/Record.php - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function getProfileTabFieldPermissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getProfileTabFieldPermissions($tabId)
                    {
                        if (!isset($this->profile_tab_field_permissions[$tabId])) {
                            $profile2TabFieldPermissions = [];
                            if ($this->getId()) {
                Severity: Minor
                Found in modules/Settings/Profiles/models/Record.php - About 25 mins to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                The method saveModulePermissions() has an NPath complexity of 12996. The configured NPath complexity threshold is 200.
                Open

                    protected function saveModulePermissions($moduleModel, $permissions)
                    {
                        $db = \App\Db::getInstance();
                        $dbCommand = $db->createCommand();
                        $profileId = $this->getId();

                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 saveModulePermissions() has 136 lines of code. Current threshold is set to 100. Avoid really long methods.
                Open

                    protected function saveModulePermissions($moduleModel, $permissions)
                    {
                        $db = \App\Db::getInstance();
                        $dbCommand = $db->createCommand();
                        $profileId = $this->getId();

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

                    public function save()
                    {
                        $db = App\Db::getInstance();
                        $profileName = $this->get('profilename');
                        $description = $this->get('description');

                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

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

                    public function getModulePermissions()
                    {
                        if (!isset($this->module_permissions)) {
                            $allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
                            $profileTabPermissions = $this->getProfileTabPermissions();

                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

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

                    protected function saveModulePermissions($moduleModel, $permissions)
                    {
                        $db = \App\Db::getInstance();
                        $dbCommand = $db->createCommand();
                        $profileId = $this->getId();

                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

                Reduce the number of returns of this function 4, down to the maximum allowed 3.
                Open

                    public function hasModuleActionPermission($module, $action)

                Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                Noncompliant Code Example

                With the default threshold of 3:

                function myFunction(){ // Noncompliant as there are 4 return statements
                  if (condition1) {
                    return true;
                  } else {
                    if (condition2) {
                      return false;
                    } else {
                      return true;
                    }
                  }
                  return false;
                }
                

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

                class Settings_Profiles_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 28 to the 15 allowed.
                Open

                    public function getModulePermissions()

                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

                Refactor this function to reduce its Cognitive Complexity from 49 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

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

                    protected function saveModulePermissions($moduleModel, $permissions)

                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

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

                class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
                {
                    /**
                     * Profile field inactive.
                     *

                CouplingBetweenObjects

                Since: 1.1.0

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

                Example

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

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

                Missing class import via use statement (line '424', column '24').
                Open

                                $dataReader = (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 '448', column '24').
                Open

                                $dataReader = (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 '140', column '31').
                Open

                                $globalPermissions = (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 '531', column '79').
                Open

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(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

                Missing class import via use statement (line '691', column '29').
                Open

                                            'permissions' => new \yii\db\Expression($caseExpression),

                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 '976', column '17').
                Open

                        $query = (new App\Db\Query())->select(['id'])->from('vtiger_users')

                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 '22').
                Open

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(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

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

                    public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])

                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

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

                    public static function getUsersList($profileId = 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 '861', column '22').
                Open

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

                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 '838', column '22').
                Open

                        $dataReader = (new App\Db\Query())->select(['vtiger_profile.*'])

                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 '910', column '17').
                Open

                        $query = (new \App\Db\Query())->from('vtiger_profile')->where(['profilename' => $profileName]);

                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 '533', column '30').
                Open

                            ->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $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

                Missing class import via use statement (line '397', column '24').
                Open

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

                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 '375', column '36').
                Open

                                $profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])

                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 '710', column '28').
                Open

                                            'permission' => new \yii\db\Expression($caseExpression),

                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 '886', column '15').
                Open

                        $row = (new App\Db\Query())->from('vtiger_profile')

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

                                } else {
                                    //Insert Process
                                    //Standard permissions
                                    $dataToInsert = [];
                                    foreach ($actionsIdsList as $actionId => $permission) {

                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

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

                        } else {
                            $module = Vtiger_Module_Model::getInstance($module);
                            $tabId = $module->getId();
                        }

                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

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

                        } else {
                            $action = Vtiger_Action_Model::getInstance($action);
                            $actionId = $action->getId();
                        }

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

                        if (App\Cache::has('ProfilesRecordModelById', $profileId)) {

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

                                    } else {
                                        $utilityIdsList[$actionId] = $permission;
                                    }

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

                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 {
                                                $permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_INACTIVE;
                                            }

                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

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

                                } else {
                                    $visible = Settings_Profiles_Module_Model::FIELD_ACTIVE;
                                    $readOnly = Settings_Profiles_Module_Model::FIELD_READWRITE;
                                }

                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 'Vtiger_Action_Model' in method 'getModulePermissions'.
                Open

                            $allTabActions = Vtiger_Action_Model::getAll(true);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'Settings_Profiles_Module_Model' in method 'save'.
                Open

                        $allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

                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_Module_Model' in method 'getProfileTabModel'.
                Open

                            $module = Vtiger_Module_Model::getInstance($module);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'Vtiger_Field_Model' in method 'getProfileTabFieldModel'.
                Open

                            $field = Vtiger_Field_Model::getInstance($field, $profileTabModel);

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

                        } else {
                            $actionEnabled = true;
                        }

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

                            return App\Cache::get('ProfilesRecordModelById', $profileId);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

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

                        $php_max_execution_time = \App\Config::main('php_max_execution_time');

                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_Action_Model' in method 'hasModuleActionPermission'.
                Open

                            $action = Vtiger_Action_Model::getInstance($action);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'vtlib\Access' in method 'delete'.
                Open

                        vtlib\Access::syncSharingAccess();

                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 'saveModulePermissions'.
                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

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

                        } else {
                            $isModulePermitted = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
                        }

                ElseExpression

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class '\App\Privilege' in method 'saveModulePermissions'.
                Open

                            \App\Privilege::setUpdater($moduleModel->getName());

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                Avoid using static access to class 'Settings_Profiles_Module_Model' in method 'getModulePermissions'.
                Open

                            $allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

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

                                    } else {
                                        $permissions['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
                                    }

                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

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

                        } else {
                            $db->createCommand()->update('vtiger_profile', [
                                'profilename' => $profileName,
                                'description' => $description,
                                'directly_related_to_role' => $isProfileDirectlyRelatedToRole,

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

                            $actionModels = Vtiger_Action_Model::getAll(true);

                StaticAccess

                Since: 1.4.0

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

                Example

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

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

                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 {
                                    $permissions = [];
                                    $permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
                                    if ($moduleModel->isEntityModule()) {
                                        $permissions['actions'] = [];

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

                        App\Cache::save('ProfilesRecordModelById', $profileId, $profile);

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

                        } else {
                            $field = Vtiger_Field_Model::getInstance($field, $profileTabModel);
                            $fieldId = $field->getId();
                        }

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

                        $allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

                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_Module_Model' in method 'getModulePermissions'.
                Open

                            $allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

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

                            } else {
                                $dbCommand->update('vtiger_role2profile', ['profileid' => $transferProfileId], ['roleid' => $roleId, 'profileid' => $profileId])->execute();
                            }

                ElseExpression

                Since: 1.4.0

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

                Example

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

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

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

                                    $fieldId = $row['fieldid'];

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

                                    ->from('vtiger_profile2tab')

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

                                'linktype' => 'LISTVIEWRECORD',

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

                        if ($this->has('directly_related_to_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 "globalactionpermission" 3 times.
                Open

                                    ->select(['globalactionid', 'globalactionpermission'])

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

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

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

                        $modulePermissions = $moduleModule->get('permissions');

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

                                    ->from('vtiger_profile2utility')

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

                                    ->from('vtiger_profile2standardpermissions')

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

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

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

                        $fieldReadOnlyPermission = $fieldPermissions['readonly'];

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

                                'linktype' => 'LISTVIEWRECORD',

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

                        $moduleAccessPermission = $modulePermissions['is_permitted'];

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

                            ->from('vtiger_role2profile')

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

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

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

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

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

                                        $permissions['fields'] = [];

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

                        $dbCommand->delete('vtiger_profile', ['profileid' => $profileId])->execute();

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

                                'linklabel' => 'LBL_EDIT_RECORD',

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

                                    $profile2UtilityPermissions[$row['tabid']][$row['activityid']] = $row['permission'];

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

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])

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

                                    ->select(['globalactionid', 'globalactionpermission'])

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

                        if (!(4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3]))

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

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

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

                        if (App\Cache::has('ProfilesRecordModelById', $profileId)) {

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

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

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

                                    ->from('vtiger_profile2globalpermissions')

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

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

                Noncompliant Code Example

                With the default threshold of 3:

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

                Compliant Solution

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

                Exceptions

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

                Define a constant instead of duplicating this literal "description" 4 times.
                Open

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

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

                        $fieldAccessPermission = $fieldPermissions['visible'];

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

                        $moduleActionPermissions = $modulePermissions['actions'];

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

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

                Noncompliant Code Example

                With the default threshold of 3:

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

                Compliant Solution

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

                Exceptions

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

                Define a constant instead of duplicating this literal "tabid" 12 times.
                Open

                                $profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])

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

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

                Noncompliant Code Example

                With the default threshold of 3:

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

                Compliant Solution

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

                Exceptions

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

                Avoid unused local variables such as '$utilityActionName'.
                Open

                                    foreach (Vtiger_Action_Model::$utilityActions as $utilityActionId => $utilityActionName) {

                UnusedLocalVariable

                Since: 0.2

                Detects when a local variable is declared and/or assigned, but not used.

                Example

                class Foo {
                    public function doSomething()
                    {
                        $i = 5; // Unused
                    }
                }

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

                Argument 2 (field) is \Vtiger_Field_Model|\vtlib\Field|\vtlib\FieldBasic but \Settings_Profiles_Record_Model::hasModuleFieldWritePermission() takes int defined at /code/modules/Settings/Profiles/models/Record.php:263
                Open

                        if ($this->hasModuleFieldWritePermission($module, $field)) {

                Argument 1 (module) is string but \Settings_Profiles_Record_Model::getProfileTabModel() takes \Vtiger_Module_Model defined at /code/modules/Settings/Profiles/models/Record.php:324
                Open

                        $moduleModule = $this->getProfileTabModel($module);

                Argument 1 (value) is \Vtiger_Field_Model|\vtlib\Field|\vtlib\FieldBasic but \Vtiger_Field_Model::getInstance() takes int|string defined at /code/modules/Vtiger/models/Field.php:1158
                Open

                            $field = Vtiger_Field_Model::getInstance($field, $profileTabModel);

                Argument 2 (field) is int but \Settings_Profiles_Record_Model::getProfileTabFieldModel() takes \Vtiger_Field_Model defined at /code/modules/Settings/Profiles/models/Record.php:348
                Open

                        $fieldModel = $this->getProfileTabFieldModel($module, $field);

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_permissions
                Open

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

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

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

                Argument 1 (module) is string but \Settings_Profiles_Record_Model::getProfileTabModel() takes \Vtiger_Module_Model defined at /code/modules/Settings/Profiles/models/Record.php:324
                Open

                        $profileTabModel = $this->getProfileTabModel($module);

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_utility_permissions
                Open

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

                Argument 1 (module) is string but \Settings_Profiles_Record_Model::getProfileTabModel() takes \Vtiger_Module_Model defined at /code/modules/Settings/Profiles/models/Record.php:324
                Open

                        $moduleModel = $this->getProfileTabModel($module);

                Argument 2 (field) is int but \Settings_Profiles_Record_Model::getProfileTabFieldModel() takes \Vtiger_Field_Model defined at /code/modules/Settings/Profiles/models/Record.php:348
                Open

                        $fieldModel = $this->getProfileTabFieldModel($module, $field);

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_field_permissions (Did you mean $profile2TabFieldPermissions)
                Open

                            $this->profile_tab_field_permissions[$tabId] = $profile2TabFieldPermissions;

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_action_permissions (Did you mean $profile2ActionPermissions)
                Open

                        return $this->profile_action_permissions;

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

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

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

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

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

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

                Reference to undeclared property \Settings_Profiles_Record_Model->global_permissions
                Open

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

                Reference to undeclared property \Settings_Profiles_Record_Model->global_permissions (Did you mean $globalPermissions)
                Open

                            $this->global_permissions = $globalPermissions;

                Reference to undeclared property \Settings_Profiles_Record_Model->global_permissions (Did you mean $globalPermissions)
                Open

                        return $this->global_permissions;

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_permissions (Did you mean $profile2TabPermissions)
                Open

                            $this->profile_tab_permissions = $profile2TabPermissions;

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_field_permissions
                Open

                        if (!isset($this->profile_tab_field_permissions[$tabId])) {

                Argument 1 (value) is \App\Base|\Vtiger_Action_Model but \Vtiger_Action_Model::getInstance() takes int defined at /code/modules/Vtiger/models/Action.php:126
                Open

                            $action = Vtiger_Action_Model::getInstance($action);

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_field_permissions (Did you mean $profile2TabFieldPermissions)
                Open

                        return $this->profile_tab_field_permissions[$tabId];

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_permissions (Did you mean $profile2TabPermissions)
                Open

                        return $this->profile_tab_permissions;

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_action_permissions (Did you mean $profile2ActionPermissions)
                Open

                            $this->profile_action_permissions = $profile2ActionPermissions;

                Returning type \Settings_Profiles_Record_Model but setId() is declared to return int
                Open

                        return $this;

                Argument 1 (mixed) is \Vtiger_Module_Model|\vtlib\Module|\vtlib\ModuleBasic but \Vtiger_Module_Model::getInstance() takes int|string defined at /code/modules/Vtiger/models/Module.php:197
                Open

                            $module = Vtiger_Module_Model::getInstance($module);

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

                                $profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_action_permissions
                Open

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

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_utility_permissions (Did you mean $profile2UtilityPermissions)
                Open

                            $this->profile_utility_permissions = $profile2UtilityPermissions;

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

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])

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

                        App\Cache::save('ProfilesRecordModelById', $profileId, $profile);

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

                        $query = (new App\Db\Query())->select(['id'])->from('vtiger_users')

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

                        $query = (new \App\Db\Query())->from('vtiger_profile')->where(['profilename' => $profileName]);

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

                                                $caseExpression .= " WHEN operation = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";

                Argument 1 (moduleName) is false but \App\Privilege::setUpdater() takes string defined at /code/app/Privilege.php:575
                Open

                            \App\Privilege::setUpdater($moduleModel->getName());

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

                        $row = (new App\Db\Query())->from('vtiger_profile')

                Default value for int $profileId can't be false
                Open

                    public static function getUsersList($profileId = false)

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

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])

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

                        $dbCommand = $db->createCommand();

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

                                        $caseExpression .= " ELSE {$db->quoteValue(1)} END ";

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

                        $db->createCommand()->insert('vtiger_profile2globalpermissions', [

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

                            return App\Cache::get('ProfilesRecordModelById', $profileId);

                Reference to undeclared property \Settings_Profiles_Record_Model->module_permissions
                Open

                        return $this->module_permissions;

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

                            $db->createCommand()->update('vtiger_profile', [

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

                        if (App\Cache::has('ProfilesRecordModelById', $profileId)) {

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

                                            $caseExpression .= " WHEN activityid = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";

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

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

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

                        $dbCommand = \App\Db::getInstance()->createCommand();

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

                        $db->createCommand()->insert('vtiger_profile2globalpermissions', [

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

                    public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])

                Reference to undeclared property \Settings_Profiles_Record_Model->module_permissions
                Open

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

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

                            $db->createCommand()->delete('vtiger_profile2globalpermissions', ['profileid' => $profileId])->execute();

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

                                            'permissions' => new \yii\db\Expression($caseExpression),

                Returning type null but getInstanceByName() is declared to return \Settings_Profiles_Record_Model|\self
                Open

                        return null;

                Reference to undeclared property \Settings_Profiles_Record_Model->profile_utility_permissions (Did you mean $profile2UtilityPermissions)
                Open

                        return $this->profile_utility_permissions;

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

                            $db->createCommand()->insert('vtiger_profile', [

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

                                            'permission' => new \yii\db\Expression($caseExpression),

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

                            ->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])

                Reference to undeclared property \Settings_Profiles_Record_Model->module_permissions
                Open

                            $this->module_permissions = $allModules;

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

                        $dataReader = (new App\Db\Query())->select(['vtiger_profile.*'])

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

                    public function getProfileUtilityPermissions()
                    {
                        if (!isset($this->profile_utility_permissions)) {
                            $profile2UtilityPermissions = [];
                            if ($this->getId()) {
                Severity: Major
                Found in modules/Settings/Profiles/models/Record.php and 1 other location - About 2 hrs to fix
                modules/Settings/Profiles/models/Record.php on lines 419..436

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 127.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    public function getProfileActionPermissions()
                    {
                        if (!isset($this->profile_action_permissions)) {
                            $profile2ActionPermissions = [];
                            if ($this->getId()) {
                Severity: Major
                Found in modules/Settings/Profiles/models/Record.php and 1 other location - About 2 hrs to fix
                modules/Settings/Profiles/models/Record.php on lines 443..460

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 127.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                        $moduleActionPermission = $moduleActionPermissions[$actionId];

                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 $moduleActionPermissions. Keep variable name length under 20.
                Open

                        $moduleActionPermissions = $modulePermissions['actions'];

                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 $profile2TabPermissions. Keep variable name length under 20.
                Open

                            $profile2TabPermissions = [];

                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 $checkOnlyDirectlyRelated. Keep variable name length under 20.
                Open

                    public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])

                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 $moduleAccessPermission. Keep variable name length under 20.
                Open

                        $moduleAccessPermission = $modulePermissions['is_permitted'];

                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 $fieldReadOnlyPermission. Keep variable name length under 20.
                Open

                        $fieldReadOnlyPermission = $fieldPermissions['readonly'];

                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 $profile2UtilityPermissions. Keep variable name length under 20.
                Open

                            $profile2UtilityPermissions = [];

                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 $profile2ActionPermissions. Keep variable name length under 20.
                Open

                            $profile2ActionPermissions = [];

                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 $profileTabPermissions. Keep variable name length under 20.
                Open

                            $profileTabPermissions = $this->getProfileTabPermissions();

                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 $defaultFieldPermission. Keep variable name length under 20.
                Open

                            $defaultFieldPermission = $this->getId() ? Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE : Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

                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 $profileUtilityPermissions. Keep variable name length under 20.
                Open

                        $profileUtilityPermissions = $this->getProfileUtilityPermissions();

                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 $fieldAccessPermission. Keep variable name length under 20.
                Open

                        $fieldAccessPermission = $fieldPermissions['visible'];

                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 $profileActionPermissions. Keep variable name length under 20.
                Open

                            $profileActionPermissions = $this->getProfileActionPermissions();

                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 $isProfileDirectlyRelatedToRole. Keep variable name length under 20.
                Open

                        $isProfileDirectlyRelatedToRole = 0;

                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 $profileActionPermissions. Keep variable name length under 20.
                Open

                        $profileActionPermissions = $this->getProfileActionPermissions();

                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 $fieldAccessPermission. Keep variable name length under 20.
                Open

                        $fieldAccessPermission = $fieldPermissions['visible'];

                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 $profileUtilityPermissions. Keep variable name length under 20.
                Open

                            $profileUtilityPermissions = $this->getProfileUtilityPermissions();

                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 $profileTabPermissionsBase. Keep variable name length under 20.
                Open

                        $profileTabPermissionsBase = $this->getProfileTabPermissions();

                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 $profileTabPermissions. Keep variable name length under 20.
                Open

                        $profileTabPermissions = $profileTabPermissionsBase[$tabId] ?? false;

                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 $moduleAccessPermission. Keep variable name length under 20.
                Open

                        $moduleAccessPermission = $modulePermissions['is_permitted'];

                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 $profile2TabFieldPermissions. Keep variable name length under 20.
                Open

                            $profile2TabFieldPermissions = [];

                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 $php_max_execution_time. Keep variable name length under 20.
                Open

                        $php_max_execution_time = \App\Config::main('php_max_execution_time');

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

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

                    protected function setId($id)

                ShortVariable

                Since: 0.2

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

                Example

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

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

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

                class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
                {
                    /**
                     * Profile field inactive.
                     *

                CamelCaseClassName

                Since: 0.2

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

                Example

                class class_name {
                }

                Source

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

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

                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

                    public function getDescription()

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

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

                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

                    public function getGlobalPermissions()

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

                     *

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

                        $globalPermissions = $this->getGlobalPermissions();

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

                     * Profile field inactive.

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

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

                     * Check if has global write permission.

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

                     * @var 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 string

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

                     * Function to get the description of the Profile.

                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=Profiles&parent=Settings&action=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

                            return true;

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

                     * Profile field readwrite.

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

                    const PROFILE_FIELD_READWRITE = 2;

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

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

                        if (Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $viewAllPermission) {

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

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

                    /**

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

                    const PROFILE_FIELD_INACTIVE = 0;

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

                     * @param mixed $id

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

                    protected function setId($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

                    public function getEditViewUrl()

                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

                            $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW] = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT] = Settings_Profiles_Module_Model::GLOBAL_ACTION_DEFAULT_VALUE;

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

                     * Check if has global read permission.

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

                            && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $editAllPermission) {

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

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

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

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

                            $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW] = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT] = Settings_Profiles_Module_Model::GLOBAL_ACTION_DEFAULT_VALUE;

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

                     *

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

                    }

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

                     */

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

                            if ($this->getId()) {

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

                                    ->select(['globalactionid', 'globalactionpermission'])

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

                    /**

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

                        $viewAllPermission = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW];

                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

                     * Field locked UI types.

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

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

                        return 'index.php?module=Profiles&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

                    {

                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 bool

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

                     */

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

                     */

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

                     */

                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=Profiles&parent=Settings&view=Edit&record=' . $this->getId();

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

                    public function getDuplicateViewUrl()

                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->global_permissions)) {

                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->global_permissions = $globalPermissions;

                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->get('profileid');

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

                        $this->set('profileid', $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

                     * Return global permissions.

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

                            $globalPermissions = [];

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

                                    ->where(['profileid' => $this->getId()])

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

                    public function hasGlobalReadPermission()

                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

                     * Profile field readonly.

                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

                     * 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

                     */

                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

                                    ->createCommand()->queryAllByGroup(0);

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

                        if ($this->hasGlobalReadPermission()

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

                     *

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

                    }

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

                     * @return string

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

                    /**

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

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

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

                        return $this->global_permissions;

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

                     * @var 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 int Profile 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

                     */

                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

                     * @var array

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

                    private static $fieldLockedUiTypes = [70];

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

                    public function getId()

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

                     */

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

                    /**

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

                    /**

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

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

                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

                     */

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

                                    ->from('vtiger_profile2globalpermissions')

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

                     * @return bool

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

                        $globalPermissions = $this->getGlobalPermissions();

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

                        $editAllPermission = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT];

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

                    const PROFILE_FIELD_READONLY = 1;

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

                     *

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

                     */

                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;

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

                     * Function to get the Profile Name.

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

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

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

                        return '?module=Profiles&parent=Settings&view=Edit&from_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

                     * Function to get the Detail Action Url for the Profile.

                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

                        $modulePermissions = $moduleModule->get('permissions');

                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

                        $fieldAccessPermission = $fieldPermissions['visible'];

                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

                        $moduleAccessPermission = $modulePermissions['is_permitted'];

                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

                        $fieldModel = $this->getProfileTabFieldModel($module, $field);

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

                     * @param string $module

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

                                || 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')

                Line exceeds 120 characters; contains 176 characters
                Open

                            && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldAccessPermission && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldReadOnlyPermission) {

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

                        if ($this->hasModuleFieldWritePermission($module, $field)) {

                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

                        return false;

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

                     * @return bool

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

                            return false;

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

                        $moduleActionPermissions = $modulePermissions['actions'];

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

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

                        $fieldReadOnlyPermission = $fieldPermissions['readonly'];

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

                    /**

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

                     * @param string             $module

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

                     * @param int    $field

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

                            return true;

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

                        $moduleModule = $this->getProfileTabModel($module);

                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 (Settings_Profiles_Module_Model::IS_PERMITTED_VALUE != $moduleAccessPermission) {

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

                    public function hasModuleFieldPermission($module, $field)

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

                        $fieldModel = $this->getProfileTabFieldModel($module, $field);

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

                                || 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')

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

                     * @param Vtiger_Field_Model $field

                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::PROFILE_FIELD_INACTIVE;

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

                     * Check if module field is locked.

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

                            || \in_array($fieldModel->getUIType(), self::$fieldLockedUiTypes)

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

                        if (\is_object($module) && is_a($module, 'Vtiger_Module_Model')) {

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

                     * Check if has module action permission.

                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 Vtiger_Action_Model $action

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

                     *

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

                            $action = Vtiger_Action_Model::getInstance($action);

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

                        $modulePermissions = $moduleModel->get('permissions');

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

                     * @param string             $module

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

                        $fieldPermissions = $fieldModel->get('permissions');

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

                            && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldAccessPermission) {

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

                        $fieldAccessPermission = $fieldPermissions['visible'];

                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

                            $tabId = $module->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

                                4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3])

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

                        if (!$this->hasModuleFieldPermission($module, $field)) {

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

                        $fieldModel = $this->getProfileTabFieldModel($module, $field);

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

                        $tabId = false;

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

                     * @return bool

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

                        }

                Line exceeds 120 characters; contains 138 characters
                Open

                        if (isset($moduleActionPermissions[$actionId]) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleActionPermission) {

                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 hasModuleFieldWritePermission($module, $field)

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

                        if (!(

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

                     *

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

                    }

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

                     * @param string $module

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

                    public function hasModulePermission($module)

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

                            return true;

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

                    }

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

                     * @param string              $module

                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_object($action) && is_a($action, 'Vtiger_Action_Model')) {

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

                        if (!$actionId) {

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

                        $moduleActionPermission = $moduleActionPermissions[$actionId];

                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

                            || 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')

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

                     * @return bool|Vtiger_Module_Model

                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 (!(4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3]))

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

                            return true;

                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 (isset($modulePermissions['is_permitted']) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleAccessPermission) {

                Line exceeds 120 characters; contains 137 characters
                Open

                        if (isset($modulePermissions['is_permitted']) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleAccessPermission) {

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

                     * Return module field permission value.

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

                            || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')

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

                            || (1 !== $fieldModel->getDisplayType() && 10 !== $fieldModel->getDisplayType());

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

                     * Return profile tab model.

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

                     * @param Vtiger_Module_Model $module

                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

                    /**

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

                    public function hasModuleActionPermission($module, $action)

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

                            $actionId = $action->getId();

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

                     * @param Vtiger_Field_Model $field

                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 int    $field

                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 $fieldModel->isMandatory() || \in_array($fieldModel->get('presence'), [1, 3])

                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

                            $actionId = $action->getId();

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

                        if (isset($moduleActionPermissions[$actionId]) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleActionPermission) {

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

                            return true;

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

                    }

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

                            && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldAccessPermission && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldReadOnlyPermission) {

                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

                            return self::PROFILE_FIELD_READWRITE;

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

                        return self::PROFILE_FIELD_READONLY;

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

                     * @param string $module

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

                     * @return bool

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

                    public function getProfileTabModel($module)

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

                    {

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

                            $module = Vtiger_Module_Model::getInstance($module);

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

                        $moduleAccessPermission = $modulePermissions['is_permitted'];

                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

                     * Check if has module field permission.

                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

                        $fieldPermissions = $fieldModel->get('permissions');

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

                    public function getModuleFieldPermissionValue($module, $field)

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

                    public function isModuleFieldLocked($module, $field)

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

                     * Check if has module permission.

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

                     * @return bool

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

                     */

                Line exceeds 120 characters; contains 124 characters
                Open

                                || 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')

                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

                     *

                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

                     * @return bool

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

                    {

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

                    }

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

                    }

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

                        $actionId = false;

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

                        $moduleModel = $this->getProfileTabModel($module);

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

                     */

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

                     * Check if has module field write permission.

                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

                                    ->where(['profileid' => $this->getId(), 'tabid' => $tabId])

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

                                    $readOnly = $row['readonly'];

                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

                                    ->from('vtiger_profile2utility')

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

                                if (isset($profileTabPermissions[$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

                        $moduleFields = $profileTabModel->getFields();

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

                        return $this->profile_tab_permissions;

                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->profile_tab_field_permissions[$tabId])) {

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

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

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

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

                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

                            $this->profile_utility_permissions = $profile2UtilityPermissions;

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

                    {

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

                            $profileTabPermissions = $this->getProfileTabPermissions();

                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 getProfileTabFieldPermissions($tabId)

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

                                    $profile2TabFieldPermissions[$fieldId]['visible'] = $visible;

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

                            $this->profile_tab_field_permissions[$tabId] = $profile2TabFieldPermissions;

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

                     * Function to get permission for actions.

                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

                            $defaultFieldPermission = $this->getId() ? Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE : Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                                }

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

                        }

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

                     * @param int $tabId

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

                                }

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

                        }

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

                    {

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

                            if ($this->getId()) {

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

                            $fieldId = $field->getId();

                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

                    /**

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

                            $profile2TabFieldPermissions = [];

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

                                    ->from('vtiger_profile2standardpermissions')

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

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

                            $allTabActions = Vtiger_Action_Model::getAll(true);

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

                                foreach ($allTabActions as $actionModel) {

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

                    /**

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

                        $profileTabModel = $this->getProfileTabModel($module);

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

                            $field = Vtiger_Field_Model::getInstance($field, $profileTabModel);

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

                                    ->from('vtiger_profile2tab')

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

                                    ->where(['profileid' => $this->getId()])

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

                            $this->profile_tab_permissions = $profile2TabPermissions;

                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 profile tab field permissions.

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

                                    $fieldId = $row['fieldid'];

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

                                    ->where(['profileid' => $this->getId()])

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

                            foreach ($allModules as $id => $moduleModel) {

                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

                     * Return profile tab field model.

                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

                                $dataReader->close();

                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

                                    $profile2UtilityPermissions[$row['tabid']][$row['activityid']] = $row['permission'];

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

                    public function getModulePermissions()

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

                                    $actionId = $actionModel->getId();

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

                                    if (isset($profileActionPermissions[$id][$actionId])) {

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

                            $tabId = $module->getId();

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

                     * @return bool|Vtiger_Field_Model

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

                            $fieldId = $field->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

                                    ->createCommand()->queryAllByGroup(0);

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

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

                        if (!$tabId) {

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

                     * @param Vtiger_Field_Model $field

                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

                                    $profile2TabFieldPermissions[$fieldId]['readonly'] = $readOnly;

                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

                                $permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                                        $permissions['actions'][$actionId] = $profileActionPermissions[$id][$actionId];

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

                        $allModulePermissions = $this->getModulePermissions();

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

                        return $moduleFields[$field->getName()];

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

                            $profile2TabPermissions = [];

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

                                    $visible = $row['visible'];

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

                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

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

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

                            $profileActionPermissions = $this->getProfileActionPermissions();

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

                                    $permissions['is_permitted'] = $profileTabPermissions[$id];

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

                        return $allModulePermissions[$tabId];

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

                     * @param string             $module

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

                        if (\is_object($field) && is_a($field, 'Vtiger_Field_Model')) {

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

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

                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

                            $profile2ActionPermissions = [];

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

                            if ($this->getId()) {

                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

                            $this->profile_action_permissions = $profile2ActionPermissions;

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

                            $profileUtilityPermissions = $this->getProfileUtilityPermissions();

                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 array

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

                                    $profile2ActionPermissions[$row['tabid']][$row['operation']] = $row['permissions'];

                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 permissions for utility actions.

                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

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

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

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

                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

                                $dataReader->close();

                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

                     * Return module permissions.

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

                        return $this->profile_tab_field_permissions[$tabId];

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

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

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

                                $permissions['actions'] = [];

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

                                }

                Line exceeds 120 characters; contains 160 characters
                Open

                            $defaultFieldPermission = $this->getId() ? Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE : Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                     *

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

                        if (!$fieldId) {

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

                     * Function to get permissions for modules.

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

                     */

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

                                $profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])

                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

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

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

                        return $this->profile_action_permissions;

                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

                    public function getProfileTabPermissions()

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

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

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

                        return $this->profile_utility_permissions;

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

                            $allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

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

                    public function getProfileTabFieldModel($module, $field)

                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

                            $profile2UtilityPermissions = [];

                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

                                $permissions = [];

                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

                            ])->execute();

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

                            'profileid' => $profileId,

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

                        if (\count($allModuleModules) > 0) {

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

                                        $fieldPermissions['visible'] = $allFieldPermissions[$fieldId]['visible'];

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

                     * @param Settings_Profiles_Record_Model $transferToRecord

                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

                            $roleId = $row['roleid'];

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

                        $dbCommand->delete('vtiger_profile', ['profileid' => $profileId])->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

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

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

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

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

                                        $actionId = $actionModel->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

                     * @return int

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

                        $profileId = $this->getId();

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

                            $db->createCommand()->insert('vtiger_profile', [

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

                            ], ['profileid' => $profileId])->execute();

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

                        $db->createCommand()->insert('vtiger_profile2globalpermissions', [

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

                            $actionModels = Vtiger_Action_Model::getAll(true);

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

                                                $permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_INACTIVE;

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

                                    $fieldPermissions = [];

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

                                        $fieldPermissions['readonly'] = $allFieldPermissions[$fieldId]['readonly'];

                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

                            'globalactionpermission' => $this->tranformInputPermissionValue($this->get('editall')),

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

                            'globalactionpermission' => $this->tranformInputPermissionValue($this->get('viewall')),

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

                                            } elseif ($fieldModel->isViewEnabled()) {

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

                                        $permissions['actions'][$actionId] = $profileUtilityPermissions[$id][$actionId];

                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

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

                            $profileId = $db->getLastInsertID('vtiger_profile_profileid_seq');

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

                                'profilename' => $profileName,

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

                            'globalactionid' => Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW,

                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

                            'globalactionid' => Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT,

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

                                            $profilePermissions[$moduleId]['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;

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

                                } else {

                Line exceeds 120 characters; contains 132 characters
                Open

                                                $permissions['actions'][$actionModel->getId()] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                                    $fieldPermissions['visible'] = $defaultFieldPermission;

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

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

                            $profileCount = $row['profilecount'];

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

                                $dbCommand->delete('vtiger_role2profile', ['roleid' => $roleId, 'profileid' => $profileId])->execute();

                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

                                $dbCommand->update('vtiger_role2profile', ['profileid' => $transferProfileId], ['roleid' => $roleId, 'profileid' => $profileId])->execute();

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

                        $profilePermissions = $this->get('profile_permissions');

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

                                'directly_related_to_role' => $isProfileDirectlyRelatedToRole,

                Line exceeds 120 characters; contains 121 characters
                Open

                        $allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

                Line exceeds 120 characters; contains 135 characters
                Open

                                            $profilePermissions[$moduleId]['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;

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

                                    $this->saveModulePermissions($moduleModel, $permissions);

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

                                    }

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

                        $dbCommand->delete('vtiger_profile2globalpermissions', ['profileid' => $profileId])->execute();

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

                        $dbCommand->delete('vtiger_profile2tab', ['profileid' => $profileId])->execute();

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

                        $dbCommand->delete('vtiger_profile2standardpermissions', ['profileid' => $profileId])->execute();

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

                                'description' => $description,

                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

                                    foreach ($actionModels as $actionModel) {

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

                                        if (!isset($profilePermissions[$moduleId]['actions'][$actionId]) && $actionModel->isModuleEnabled($moduleModel)) {

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

                                            if ($actionModel->isModuleEnabled($moduleModel)) {

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

                                    } elseif (isset($profileUtilityPermissions[$id][$actionId])) {

                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

                                        $permissions['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;

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

                                    $fieldPermissions['readonly'] = $defaultFieldPermission;

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

                    }

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

                        $profileName = $this->get('profilename');

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

                                    $this->saveModulePermissions($moduleModel, $profilePermissions[$moduleId]);

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

                                        foreach ($actionModels as $actionModel) {

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

                                        }

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

                                $allFieldPermissions = $this->getProfileTabFieldPermissions($id);

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

                        return $this->module_permissions;

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

                        $dbCommand->delete('vtiger_profile2utility', ['profileid' => $profileId])->execute();

                Line exceeds 120 characters; contains 123 characters
                Open

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])

                Line exceeds 120 characters; contains 140 characters
                Open

                            ->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])

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

                                'directly_related_to_role' => $isProfileDirectlyRelatedToRole,

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

                                            if ($fieldModel->isWritable()) {

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

                                $moduleFields = $moduleModel->getFields();

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

                                    $fieldId = $fieldModel->getId();

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

                                    if (isset($allFieldPermissions[$fieldId]['readonly'])) {

                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

                                'profilename' => $profileName,

                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

                        $db->createCommand()->insert('vtiger_profile2globalpermissions', [

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

                            'profileid' => $profileId,

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

                                $moduleId = $moduleModel->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

                                                $permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_READONLY;

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

                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

                        vtlib\Access::syncSharingAccess();

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

                     * Save record to database.

                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

                                    $permissions = [];

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

                                    if ($moduleModel->isEntityModule()) {

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

                                        foreach ($moduleFields as $fieldModel) {

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

                                                $permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_READWRITE;

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

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

                        $dbCommand = \App\Db::getInstance()->createCommand();

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

                        $transferProfileId = $transferToRecord->getId();

                Line exceeds 120 characters; contains 156 characters
                Open

                                $dbCommand->update('vtiger_role2profile', ['profileid' => $transferProfileId], ['roleid' => $roleId, 'profileid' => $profileId])->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

                            $db->createCommand()->update('vtiger_profile', [

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

                            foreach ($allModuleModules as $moduleModel) {

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

                                foreach ($moduleFields as $fieldModel) {

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

                                    if (isset($allFieldPermissions[$fieldId]['visible'])) {

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

                                $moduleModel->set('permissions', $permissions);

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

                            $this->module_permissions = $allModules;

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

                        $dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])

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

                            ->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])

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

                            if ($profileCount > 1) {

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

                    public function save()

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

                        if (!$profileId) {

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

                                    }

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

                                        $permissions['actions'] = [];

                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

                                    }

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

                            ->groupBy('roleid')

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

                            $db->createCommand()->delete('vtiger_profile2globalpermissions', ['profileid' => $profileId])->execute();

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

                                if ($moduleModel->isActive() && isset($profilePermissions[$moduleId])) {

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

                                    $permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                                }

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

                        $dbCommand->delete('vtiger_profile2field', ['profileid' => $profileId])->execute();

                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

                        $isProfileDirectlyRelatedToRole = 0;

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

                                        $moduleFields = $moduleModel->getFields();

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

                        }

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

                                    $fieldModel->set('permissions', $fieldPermissions);

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

                     * Delete record and optionally transfer assigments to other 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

                    {

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

                            $isProfileDirectlyRelatedToRole = $this->get('directly_related_to_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

                            $this->setId($profileId);

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

                                'description' => $description,

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

                        $allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());

                Line exceeds 120 characters; contains 138 characters
                Open

                                        if (!isset($profilePermissions[$moduleId]['actions'][$actionId]) && $actionModel->isModuleEnabled($moduleModel)) {

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

                                                $permissions['actions'][$actionModel->getId()] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                                        $permissions['fields'] = [];

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

                        $tabId = $moduleModel->getId();

                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

                                            'permissions' => new \yii\db\Expression($caseExpression),

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

                                        $dbCommand->update('vtiger_profile2utility', [

                Line exceeds 120 characters; contains 152 characters
                Open

                                        $dbCommand->batchInsert('vtiger_profile2utility', ['profileid', 'tabid', 'activityid', 'permission'], $dataToInsert)->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 (isset($permissions['actions']) || $moduleModel->isUtilityActionEnabled()) {

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

                                    }

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

                                            $caseExpression .= " WHEN activityid = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";

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

                        if ($moduleModel->isEntityModule() || $moduleModel->isUtilityActionEnabled()) {

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

                                $actionPermissions = $permissions['actions'] ?? [];

                Line exceeds 120 characters; contains 138 characters
                Open

                                if ($profileActionPermissions || isset($profileTabPermissionsBase[$tabId]) || isset($profileUtilityPermissions[$tabId])) {

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

                                        foreach ($actionsIdsList as $actionId => $permission) {

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

                                        }

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

                                        $dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];

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

                                        $actionEnabled = true;

                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

                        if ($isModulePermitted != $profileTabPermissions) {

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

                                    $readOnly = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

                     * Save module permissions to database.

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

                        $profileTabPermissions = $profileTabPermissionsBase[$tabId] ?? false;

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

                            $isModulePermitted = $this->tranformInputPermissionValue($permissions['is_permitted']);

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

                            'tabid' => $tabId,

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

                                } elseif (self::PROFILE_FIELD_READONLY == $stateValue) {

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

                                    'profileid' => $profileId,

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

                     * @param array               $permissions

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

                        $actionPermissions = [];

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

                                        }

                Line exceeds 120 characters; contains 164 characters
                Open

                                        $dbCommand->batchInsert('vtiger_profile2standardpermissions', ['profileid', 'tabid', 'operation', 'permissions'], $dataToInsert)->execute();

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

                                    //Utility permissions

                Line exceeds 120 characters; contains 124 characters
                Open

                                        $dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];

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

                                        $dbCommand->batchInsert('vtiger_profile2utility', ['profileid', 'tabid', 'activityid', 'permission'], $dataToInsert)->execute();

                Line exceeds 120 characters; contains 141 characters
                Open

                                $dbCommand->delete('vtiger_profile2field', ['profileid' => $profileId, 'tabid' => $tabId, 'fieldid' => $fieldId])->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

                                //Dividing on actions

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

                                foreach ($actionPermissions as $actionId => $permission) {

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

                                    //Standard permissions

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

                                    foreach (Vtiger_Action_Model::$utilityActions as $utilityActionId => $utilityActionName) {

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

                                    //Utility permissions

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

                                            'permission' => new \yii\db\Expression($caseExpression),

                Line exceeds 120 characters; contains 124 characters
                Open

                                        $dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];

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

                                    }

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

                                $dbCommand->insert('vtiger_profile2field', [

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

                        $profileId = $this->getId();

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

                                //Update process

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

                                    } elseif ($actionsIdsList) {

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

                                            }

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

                                        $dbCommand->update('vtiger_profile2standardpermissions', [

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

                                    //Standard permissions

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

                                    $dataToInsert = [];

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

                            }

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

                            'profileid' => $profileId,

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

                                    $readOnly = Settings_Profiles_Module_Model::FIELD_READONLY;

                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

                        $profileActionPermissions = $this->getProfileActionPermissions();

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

                        $dbCommand->delete('vtiger_profile2tab', ['profileid' => $profileId, 'tabid' => $tabId])->execute();

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

                        $actionEnabled = false;

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

                                        $actionEnabled = true;

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

                                            if (isset(Vtiger_Action_Model::$standardActions[$actionId])) {

                Line exceeds 120 characters; contains 142 characters
                Open

                                                $caseExpression .= " WHEN operation = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";

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

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

                            $actionEnabled = true;

                Line exceeds 120 characters; contains 145 characters
                Open

                        // Enable module permission in profile2tab table only if either its an extension module or the entity module has atleast 1 action enabled

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

                            \App\Privilege::setUpdater($moduleModel->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

                        $profileUtilityPermissions = $this->getProfileUtilityPermissions();

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

                                        if (\in_array($permission, Vtiger_Action_Model::$nonConfigurableActions)) {

                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

                                $dbCommand->delete('vtiger_profile2field', ['profileid' => $profileId, 'tabid' => $tabId, 'fieldid' => $fieldId])->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

                                        ], ['profileid' => $profileId, 'tabid' => $tabId])->execute();

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

                                        if (!isset($utilityIdsList[$utilityActionId])) {

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

                                        $actionEnabled = true;

                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 ($actionsIdsList && ($moduleModel->isEntityModule())) {

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

                                        $actionEnabled = true;

                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($permissions['fields']) && \is_array($permissions['fields'])) {

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

                        $dbCommand = $db->createCommand();

                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 ($profileActionPermissions || isset($profileTabPermissionsBase[$tabId]) || isset($profileUtilityPermissions[$tabId])) {

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

                                        ], ['profileid' => $profileId, 'tabid' => $tabId])->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 ($actionEnabled && isset($permissions['is_permitted'])) {

                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

                            $isModulePermitted = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;

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

                                if (self::PROFILE_FIELD_INACTIVE == $stateValue) {

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

                        $profileActionPermissions = $profileActionPermissions[$tabId] ?? false;

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

                                $utilityIdsList = [];

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

                                        $actionsIdsList[$actionId] = $permission;

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

                                            if (\in_array($permission, Vtiger_Action_Model::$nonConfigurableActions)) {

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

                                                }

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

                                                $caseExpression .= " WHEN operation = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";

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

                                    foreach ($actionsIdsList as $actionId => $permission) {

                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 ($utilityIdsList as $actionId => $permission) {

                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

                                    $visible = Settings_Profiles_Module_Model::FIELD_INACTIVE;

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

                                    $visible = Settings_Profiles_Module_Model::FIELD_ACTIVE;

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

                                    $visible = Settings_Profiles_Module_Model::FIELD_ACTIVE;

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

                                    $readOnly = Settings_Profiles_Module_Model::FIELD_READWRITE;

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

                            }

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

                                        $caseExpression .= 'ELSE permissions END ';

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

                                        $dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];

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

                        // Enable module permission in profile2tab table only if either its an extension module or the entity module has atleast 1 action enabled

                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

                                        $utilityIdsList[$actionId] = $permission;

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

                                    if (!$moduleModel->isEntityModule()) {

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

                                                $permission = 'on';

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

                                                    $actionEnabled = true;

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

                                            $utilityIdsList[$utilityActionId] = 'off';

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

                                            $permission = 'on';

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

                                    }

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

                                        $dbCommand->batchInsert('vtiger_profile2standardpermissions', ['profileid', 'tabid', 'operation', 'permissions'], $dataToInsert)->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

                            foreach ($permissions['fields'] as $fieldId => $stateValue) {

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

                                    'tabid' => $tabId,

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

                                    'fieldid' => $fieldId,

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

                    protected function saveModulePermissions($moduleModel, $permissions)

                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

                                    if (isset($actionsIdsList[$actionId])) {

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

                                            $permissionValue = $this->tranformInputPermissionValue($permission);

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

                                        foreach ($utilityIdsList as $actionId => $permission) {

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

                                        $caseExpression .= " ELSE {$db->quoteValue(1)} END ";

                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

                                    if ($utilityIdsList) {

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

                        }

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

                        $dbCommand->insert('vtiger_profile2tab', [

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

                                    'visible' => $visible,

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

                     * @param Vtiger_Module_Model $moduleModel

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

                        $profileTabPermissionsBase = $this->getProfileTabPermissions();

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

                                $actionsIdsList = Vtiger_Action_Model::$standardActions;

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

                                        $caseExpression = 'CASE';

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

                                                if (Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $permission) {

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

                                    }

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

                                        $caseExpression = 'CASE';

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

                                            $permissionValue = $this->tranformInputPermissionValue($permission);

                Line exceeds 120 characters; contains 139 characters
                Open

                                            $caseExpression .= " WHEN activityid = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";

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

                                        }

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

                                    //Insert Process

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

                                    $dataToInsert = [];

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

                            'permissions' => $isModulePermitted,

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

                                    'readonly' => $readOnly,

                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

                                'linklabel' => 'LBL_DELETE_RECORD',

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

                            $profiles[$profile->getId()] = $profile;

                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

                            $profile = new self();

                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

                        return Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;

                Line exceeds 120 characters; contains 125 characters
                Open

                                'linkurl' => "javascript:Settings_Vtiger_List_Js.triggerDelete(event,'" . $this->getDeleteActionUrl() . "')",

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

                        $profiles = [];

                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

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

                            $profile = new self();

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

                     * Function to check whether the profiles is directly related to role.

                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

                        foreach ($recordLinks as $recordLink) {

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

                        $dataReader = (new App\Db\Query())->select(['vtiger_profile.*'])

                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

                            ->from('vtiger_profile')

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

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

                     * Create instance by profile name.

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

                     * @param array  $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

                    /**

                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

                    /** {@inheritdoc} */

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

                            ],

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

                        return $profiles;

                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

                     * @return \self

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

                    public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $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

                    {

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

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

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

                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(['profileid' => $profileId])

                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

                            return Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;

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

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

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

                    }

                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

                        $profiles = [];

                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

                        if (!empty($excludedRecordId)) {

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

                     * Function to get the Detail Url for the current group.

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

                     *

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

                     * @param string $value

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

                            [

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

                            [

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

                    {

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

                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 App\Cache::get('ProfilesRecordModelById', $profileId);

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

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

                     * @param bool   $checkOnlyDirectlyRelated

                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 bool

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

                    /**

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

                     * @return int

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

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

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

                     *

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

                            ->where(['vtiger_role2profile.roleid' => $roleId])

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

                     * Function to get all the profiles.

                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

                            $profiles[$profile->getId()] = $profile;

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

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

                        if (App\Cache::has('ProfilesRecordModelById', $profileId)) {

                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

                    public function getRecordLinks(): array

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

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

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

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

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

                                'linktype' => 'LISTVIEWRECORD',

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

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

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

                     */

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

                            $profile = new self();

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

                    public static function getAll()

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

                            $profile->setData($row);

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

                        $profile = null;

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

                     * Transform input permission value.

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

                        if ('on' === $value || '1' === $value) {

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

                            ],

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

                                'linklabel' => 'LBL_DUPLICATE_RECORD',

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

                     * @return Settings_Profiles_Record_Model[] Array of Settings_Profiles_Record_Model instances

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

                        App\Cache::save('ProfilesRecordModelById', $profileId, $profile);

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

                        $query = (new \App\Db\Query())->from('vtiger_profile')->where(['profilename' => $profileName]);

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

                            $query->andWhere(['NOT IN', 'profileid', $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

                     */

                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

                     * @param int $profileId

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

                        }

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

                    protected function tranformInputPermissionValue($value)

                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

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

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

                                'linktype' => 'LISTVIEWRECORD',

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

                            ],

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

                        ];

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

                     * @return Settings_Profiles_Record_Model[] Array of Settings_Profiles_Record_Model instances

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

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

                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 = (new App\Db\Query())->from('vtiger_profile')

                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 static function getUsersList($profileId = false)

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

                            ->innerJoin('vtiger_user2role', 'vtiger_user2role.userid = vtiger_users.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

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

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

                     * Function to get all the profiles linked to the given 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

                     * @param string $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

                            $profile->setData($row);

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

                    public function getDetailViewUrl()

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

                        if ($profileId) {

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

                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

                        $recordLinks = [

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

                                'linkurl' => "javascript:Settings_Vtiger_List_Js.triggerDelete(event,'" . $this->getDeleteActionUrl() . "')",

                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

                    /**

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

                    public static function getAllByRole($roleId)

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

                     * Function to get the instance of Profile model, given profile id.

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

                     * @param int $profileId

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

                    public static function getInstanceById($profileId)

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

                     * @param string $profileName

                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

                        return $query->column();

                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

                                'linkicon' => 'fas fa-clone',

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

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

                            $query->andWhere(['directly_related_to_role' => 1]);

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

                            return $profile;

                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=Profiles&parent=Settings&view=Detail&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

                        $php_max_execution_time = \App\Config::main('php_max_execution_time');

                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 int[] list of user ids

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

                            ->innerJoin('vtiger_role2profile', 'vtiger_role2profile.roleid = vtiger_user2role.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

                            $query->andWhere(['vtiger_role2profile.profileid' => $profileId]);

                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(['vtiger_users.deleted' => 0]);

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

                    public function recalculate()

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

                            foreach ($userIdsList as $userId) {

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

                            return true;

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

                    }

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

                        $userIdsList = self::getUsersList($this->getId());

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

                        if ($userIdsList) {

                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 Users list from this Profile.

                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

                     *

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

                    public function isDirectlyRelated()

                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())->select(['id'])->from('vtiger_users')

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

                     * Function recalculate the 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

                     */

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

                        $isDirectlyRelated = $this->get('directly_related_to_role');

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

                        if (1 == $isDirectlyRelated) {

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

                        set_time_limit($php_max_execution_time);

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

                class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model

                The variable $php_max_execution_time is not named in camelCase.
                Open

                    public function recalculate()
                    {
                        $php_max_execution_time = \App\Config::main('php_max_execution_time');
                        set_time_limit($php_max_execution_time);
                
                

                CamelCaseVariableName

                Since: 0.2

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

                Example

                class ClassName {
                    public function doSomething() {
                        $data_module = new DataModule();
                    }
                }

                Source

                The variable $php_max_execution_time is not named in camelCase.
                Open

                    public function recalculate()
                    {
                        $php_max_execution_time = \App\Config::main('php_max_execution_time');
                        set_time_limit($php_max_execution_time);
                
                

                CamelCaseVariableName

                Since: 0.2

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

                Example

                class ClassName {
                    public function doSomething() {
                        $data_module = new DataModule();
                    }
                }

                Source

                There are no issues that match your filters.

                Category
                Status