YetiForceCompany/YetiForceCRM

View on GitHub
modules/Users/Users.php

Summary

Maintainability
B
5 hrs
Test Coverage
D
66%

Function retrieveEntityInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function retrieveEntityInfo(int $record, string $module)
    {
        \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
        if ('' == $record) {
            \App\Log::error('record is empty. returning null');
Severity: Minor
Found in modules/Users/Users.php - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method retrieveEntityInfo has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function retrieveEntityInfo(int $record, string $module)
    {
        \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
        if ('' == $record) {
            \App\Log::error('record is empty. returning null');
Severity: Minor
Found in modules/Users/Users.php - About 1 hr to fix

    The class Users has 26 fields. Consider redesigning Users to keep the number of fields under 15.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    TooManyFields

    Since: 0.1

    Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

    Example

    class Person {
       protected $one;
       private $two;
       private $three;
       [... many more fields ...]
    }

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

    Function getActiveAdminId has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getActiveAdminId()
        {
            $cache = Vtiger_Cache::getInstance();
            if ($cache->getAdminUserId()) {
                return $cache->getAdminUserId();
    Severity: Minor
    Found in modules/Users/Users.php - About 1 hr 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 retrieveEntityInfo() has an NPath complexity of 1296. The configured NPath complexity threshold is 200.
    Open

        public function retrieveEntityInfo(int $record, string $module)
        {
            \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
            if ('' == $record) {
                \App\Log::error('record is empty. returning null');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 retrieveEntityInfo() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
    Open

        public function retrieveEntityInfo(int $record, string $module)
        {
            \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
            if ('' == $record) {
                \App\Log::error('record is empty. returning null');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        public function retrieveEntityInfo(int $record, string $module)
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

    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 Users has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 '153', column '32').
    Open

                    $result[$tableName] = (new \App\Db\Query())->from($tableName)->where([$this->tab_name_index[$tableName] => $record])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 '166', column '21').
    Open

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => $this->column_fields['currency_id'], 'deleted' => 0])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 '242', column '19').
    Open

                $result = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['is_admin' => 'on', 'status' => 'Active'])->scalar();
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 '169', column '21').
    Open

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => 1])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 '204', column '23').
    Open

            $eventHandler = new App\EventHandler();
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

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

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_RECORD_NOT_FOUND||' . $record);
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    MissingImport

    Since: 2.7.0

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

    Example

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

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

    Avoid using static access to class 'App\User' in method 'transformOwnerShipAndDelete'.
    Open

                    'modified_user_id' => App\User::getCurrentUserRealId(),
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 'CRMEntity' in method 'getActiveAdminUser'.
    Open

            $user = CRMEntity::getInstance('Users');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\Field' in method 'retrieveEntityInfo'.
    Open

            $fields = \App\Field::getModuleFieldInfos($module);
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\Deprecated' in method '__construct'.
    Open

            $this->column_fields = vtlib\Deprecated::getColumnFields('Users');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\User' in method 'retrieveEntityInfo'.
    Open

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\Encryption' in method 'createAccessKey'.
    Open

                    'accesskey' => \App\Encryption::generatePassword(20, 'lbn'),
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

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

            } else {
                $currencySymbol = $currency['currency_symbol'];
            }
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\Log' in method 'retrieveEntityInfo'.
    Open

            \App\Log::trace('Exit from retrieveEntityInfo() method.');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\PrivilegeFile' in method 'getActiveAdminId'.
    Open

                $users = \App\PrivilegeFile::getUser('id');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

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

            } else {
                $adminId = 1;
                $result = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['is_admin' => 'on', 'status' => 'Active'])->scalar();
                if ($result) {
                    $adminId = $result;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\Log' in method 'retrieveEntityInfo'.
    Open

            \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\UserPrivilegesFile' in method 'createAccessKey'.
    Open

            \App\UserPrivilegesFile::createUserPrivilegesfile($this->id);
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\User' in method 'retrieveCurrentUserInfoFromFile'.
    Open

            $userPrivileges = App\User::getPrivilegesFile($userid);
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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\Log' in method 'retrieveEntityInfo'.
    Open

                \App\Log::error('record is empty. returning null');
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'App\Fields\Owner' in method 'transformOwnerShipAndDelete'.
    Open

            App\Fields\Owner::transferOwnership($userId, $transformToUserId);
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

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

            if (App\Config::performance('ENABLE_CACHING_USERS')) {
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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_Cache' in method 'getActiveAdminId'.
    Open

            $cache = Vtiger_Cache::getInstance();
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Define a constant instead of duplicating this literal "last_name" 6 times.
    Open

            'Name' => ['vtiger_users' => 'last_name'],
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            'First Name' => 'first_name',
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

        public $tab_name = ['vtiger_users', 'vtiger_user2role'];
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            $this->column_fields['currency_code'] = '';
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            'Admin' => 'is_admin',
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            $this->column_fields['currency_symbol'] = '';
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            'Email' => ['vtiger_users' => 'email1'],
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            $this->column_fields['currency_name'] = '';
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

            'Status' => 'status',
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

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

        public $module_name = 'Users';
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

    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.

    Remove this commented out code.
    Open

     * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
    Severity: Major
    Found in modules/Users/Users.php by sonar-php

    Programmers should not comment out code as it bloats programs and reduces readability.

    Unused code should be deleted and can be retrieved from source control history if required.

    See

    • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
    • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
    • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
    • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

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

            if ('' === $this->column_fields['no_of_currency_decimals']) {
    Severity: Critical
    Found in modules/Users/Users.php by sonar-php

    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 '$value_iter'.
    Open

            foreach ($this->column_fields as $field => $value_iter) {
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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

    Reference to undeclared property \Users->currency_code
    Open

            $this->column_fields['currency_code'] = $this->currency_code = $currency['currency_code'];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields = vtlib\Deprecated::getColumnFields('Users');
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['currency_name'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            foreach ($this->column_fields as $field => $value_iter) {
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Call to method trace from undeclared class \App\Log
    Open

            \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
    Severity: Critical
    Found in modules/Users/Users.php by phan

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

                    $result[$tableName] = (new \App\Db\Query())->from($tableName)->where([$this->tab_name_index[$tableName] => $record])->one();
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                    $this->column_fields[$field] = $userInfo[$field];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['record_module'] = $module;
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['currency_symbol'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phan

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

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => 1])->one();
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['currency_name'] = $this->currency_name = $currency['currency_name'];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->currency_name
    Open

            $this->column_fields['currency_name'] = $this->currency_name = $currency['currency_name'];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['conv_rate'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Call to method getPrivilegesFile from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

            $userPrivileges = App\User::getPrivilegesFile($userid);
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Call to method error from undeclared class \App\Log
    Open

                \App\Log::error('record is empty. returning null');
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['currency_code'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                    $this->{$fieldName} = $this->column_fields[$fieldName] = $result[$tableName][$fieldRow['columnname']];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['record_id'] = $record;
    Severity: Minor
    Found in modules/Users/Users.php by phan

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

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => $this->column_fields['currency_id'], 'deleted' => 0])->one();
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['currency_symbol'] = $this->currency_symbol = $currencySymbol;
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Saw misspelled annotation @returns. Did you mean @return?
    Open

         * @returns user info in $this->column_fields array:: Type array
    Severity: Info
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['currency_code'] = $this->currency_code = $currency['currency_code'];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->currency_symbol_placement
    Open

                $this->column_fields['currency_symbol_placement'] = $this->currency_symbol_placement = '1.0$';
    Severity: Minor
    Found in modules/Users/Users.php by phan

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

            App\Db::getInstance()->createCommand()
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => $this->column_fields['currency_id'], 'deleted' => 0])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            $this->column_fields['conv_rate'] = $this->conv_rate = $currency['conversion_rate'];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->conv_rate
    Open

            $this->column_fields['conv_rate'] = $this->conv_rate = $currency['conversion_rate'];
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->no_of_currency_decimals
    Open

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            if ('' == $this->column_fields['currency_grouping_pattern'] && '' == $this->column_fields['currency_symbol_placement']) {
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                $this->column_fields['currency_decimal_separator'] = $this->currency_decimal_separator = '.';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                $this->column_fields['currency_grouping_pattern'] = $this->currency_grouping_pattern = '123,456,789';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Call to method getCurrentUserRealId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                    'modified_user_id' => App\User::getCurrentUserRealId(),
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            if (!empty($this->column_fields['currency_id'])) {
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->currency_symbol (Did you mean $currencySymbol)
    Open

            $this->column_fields['currency_symbol'] = $this->currency_symbol = $currencySymbol;
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Call to undeclared method \CRMEntity::retrieveCurrentUserInfoFromFile
    Open

            $user->retrieveCurrentUserInfoFromFile($adminId);
    Severity: Critical
    Found in modules/Users/Users.php by phan

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

            App\Db::getInstance()->createCommand()
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                $this->column_fields['currency_symbol_placement'] = $this->currency_symbol_placement = '1.0$';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Returning type ?1 but getActiveAdminId() is declared to return int
    Open

            return $adminId;
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

            if ('' === $this->column_fields['no_of_currency_decimals']) {
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Call to method getCurrentUserModel from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->column_fields
    Open

                $this->column_fields['currency_grouping_separator'] = $this->currency_grouping_separator = ' ';
    Severity: Minor
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->currency_grouping_separator
    Open

                $this->column_fields['currency_grouping_separator'] = $this->currency_grouping_separator = ' ';
    Severity: Minor
    Found in modules/Users/Users.php by phan

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

                $result = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['is_admin' => 'on', 'status' => 'Active'])->scalar();
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Call to method generatePassword from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
    Open

                    'accesskey' => \App\Encryption::generatePassword(20, 'lbn'),
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Call to method trace from undeclared class \App\Log
    Open

            \App\Log::trace('Exit from retrieveEntityInfo() method.');
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->currency_grouping_pattern
    Open

                $this->column_fields['currency_grouping_pattern'] = $this->currency_grouping_pattern = '123,456,789';
    Severity: Minor
    Found in modules/Users/Users.php by phan

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

            App\Fields\Owner::transferOwnership($userId, $transformToUserId);
    Severity: Critical
    Found in modules/Users/Users.php by phan

    Reference to undeclared property \Users->currency_decimal_separator
    Open

                $this->column_fields['currency_decimal_separator'] = $this->currency_decimal_separator = '.';
    Severity: Minor
    Found in modules/Users/Users.php by phan

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

        public $additional_column_fields = ['reports_to_name'];
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

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

        public $emailTemplate_defaultFields = ['first_name', 'last_name', 'title', 'department', 'phone_home', 'phone_mobile', 'signature', 'email1'];
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 Users extends CRMEntity
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 46 and the first side effect is on line 28.
    Open

    <?php
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    The property $object_name is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $user_preferences is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $list_fields_name is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $error_string is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $tab_name is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $tab_name_index is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $default_order_by is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $list_mode is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $default_sort_order is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $new_schema is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

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

        public $id;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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 property $is_admin is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $additional_column_fields is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $module_name is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $popup_fields is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $table_name is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $search_fields_name is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $default_widgets is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $table_index is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $search_fields is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $emailTemplate_defaultFields is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $popup_type is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

    The property $record_id is not named in camelCase.
    Open

    class Users extends CRMEntity
    {
        // Stored fields
        public $id;
        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    CamelCasePropertyName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name attributes.

    Example

    class ClassName {
        protected $property_name;
    }

    Source

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

        public $authenticated = false;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $result = [];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    $result[$tableName] = (new \App\Db\Query())->from($tableName)->where([$this->tab_name_index[$tableName] => $record])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    $this->{$fieldName} = $this->column_fields[$fieldName] = $result[$tableName][$fieldRow['columnname']];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    Line exceeds 120 characters; contains 153 characters
    Open

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => $this->column_fields['currency_id'], 'deleted' => 0])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $this->column_fields['currency_symbol_placement'] = $this->currency_symbol_placement = '1.0$';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            \App\Log::trace('Exit from retrieveEntityInfo() method.');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        // Stored fields
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Role Name' => 'roleid',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        //Default Fields for Email Templates -- Pavani
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * Function to check whether the user is an Admin user.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            \App\Log::trace("Entering into retrieveEntityInfo($record, $module) method.");
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['record_id'] = $record;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $currencySymbol = $currencyArray[$currency['currency_symbol']];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    Line exceeds 120 characters; contains 206 characters
    Open

                $this->column_fields['no_of_currency_decimals'] = $this->no_of_currency_decimals = App\User::getCurrentUserId() ? (int) App\User::getCurrentUserModel()->getDetail('no_of_currency_decimals') : 2;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $this->column_fields['currency_decimal_separator'] = $this->currency_decimal_separator = '.';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $this->column_fields['currency_grouping_separator'] = $this->currency_grouping_separator = ' ';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $tab_name = ['vtiger_users', 'vtiger_user2role'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $search_fields_name = [
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $list_mode;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Login Method' => 'login_method',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $user_preferences;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $emailTemplate_defaultFields = ['first_name', 'last_name', 'title', 'department', 'phone_home', 'phone_mobile', 'signature', 'email1'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'User Name' => 'user_name',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['conv_rate'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    Line exceeds 120 characters; contains 146 characters
    Open

        public $emailTemplate_defaultFields = ['first_name', 'last_name', 'title', 'department', 'phone_home', 'phone_mobile', 'signature', 'email1'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        // This is the list of fields that are in the lists.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $userPrivileges = App\User::getPrivilegesFile($userid);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public function retrieveEntityInfo(int $record, string $module)
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => 1])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if (empty($currency)) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Admin' => 'is_admin',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $default_widgets = ['CVLVT', 'UA'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if (isset($currencyArray[$currency['currency_symbol']])) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if ('' === $this->column_fields['no_of_currency_decimals']) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $id;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $search_fields = [
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Email' => ['vtiger_users' => 'email1'],
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'First Name' => 'first_name',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /** constructor function for the main user class.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @return bool true/false
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if ('' == $record) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if ('' == $this->column_fields['currency_grouping_pattern'] && '' == $this->column_fields['currency_symbol_placement']) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $this->column_fields['currency_grouping_pattern'] = $this->currency_grouping_pattern = '123,456,789';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $is_admin;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $popup_type;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $list_fields_name = [
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @returns user info in $this->column_fields array:: Type array
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /** {@inheritdoc} */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $module_name = 'Users';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                if (isset($userInfo[$field])) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                \App\Log::error('record is empty. returning null');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['currency_symbol'] = $this->currency_symbol = $currencySymbol;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Email' => 'email1',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $encodeFields = ['first_name', 'last_name', 'description'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'FL_FORCE_PASSWORD_CHANGE' => 'force_password_change',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $table_name = 'vtiger_users';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $default_order_by = '';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        ];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $record_id;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields = vtlib\Deprecated::getColumnFields('Users');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['currency_symbol'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @param $userid -- user id:: Type integer
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        ];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                        throw new \App\Exceptions\NoPermittedToRecord('ERR_RECORD_NOT_FOUND||' . $record);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /** Function to get the current user information from the user_privileges file.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public function __construct()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['currency_code'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'First Name' => 'first_name',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                return null;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $default_sort_order = 'ASC';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            return isset($this->is_admin) && 'on' === $this->is_admin;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                if (empty($result[$tableName]) && isset($this->tab_name_index[$tableName])) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $currency = (new \App\Db\Query())->from('vtiger_currency_info')->where(['id' => $this->column_fields['currency_id'], 'deleted' => 0])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public function retrieveCurrentUserInfoFromFile($userid)
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public function isAdminUser()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->id = $userid;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['currency_name'] = $this->currency_name = $currency['currency_name'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    if (empty($result[$tableName])) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    $this->{$field} = $userInfo[$field];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            return $this;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                if (isset($result[$tableName][$fieldRow['columnname']])) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['record_module'] = $module;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['conv_rate'] = $this->conv_rate = $currency['conversion_rate'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    Line exceeds 120 characters; contains 129 characters
    Open

            if ('' == $this->column_fields['currency_grouping_pattern'] && '' == $this->column_fields['currency_symbol_placement']) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $error_string;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $tab_name_index = ['vtiger_users' => 'id', 'vtiger_user2role' => 'userid'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $table_index = 'id';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $popup_fields = ['last_name'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        //Default Widgests
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            foreach ($this->column_fields as $field => $value_iter) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $fields = \App\Field::getModuleFieldInfos($module);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            foreach ($fields as $fieldName => $fieldRow) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $tableName = $fieldRow['tablename'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    Line exceeds 120 characters; contains 140 characters
    Open

                    $result[$tableName] = (new \App\Db\Query())->from($tableName)->where([$this->tab_name_index[$tableName] => $record])->one();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $deleted;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        // This is used to retrieve related fields from form posts.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Last Name' => 'last_name',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'FL_DATE_PASSWORD_CHANGE' => 'date_password_change',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $new_schema = true;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['currency_name'] = '';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if (!empty($this->column_fields['currency_id'])) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $object_name = 'User';
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public $additional_column_fields = ['reports_to_name'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Status' => 'status',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    $this->column_fields[$field] = $userInfo[$field];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $currencyArray = ['$' => '&#36;', '&euro;' => '&#8364;', '&pound;' => '&#163;', '&yen;' => '&#165;'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $currencySymbol = $currency['currency_symbol'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->column_fields['currency_code'] = $this->currency_code = $currency['currency_code'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Name' => ['vtiger_users' => 'last_name'],
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            'Name' => 'last_name',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        ];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $userInfo = $userPrivileges['user_info'];
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $this->id = $record;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            return $this;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    'modified_user_id' => App\User::getCurrentUserRealId(),
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * Function to get the active admin user object.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $user = CRMEntity::getInstance('Users');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    'date_modified' => date('Y-m-d H:i:s'),
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $eventHandler->setParams(['userId' => $userId, 'transformToUserId' => $transformToUserId]);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $eventHandler->trigger('UsersBeforeDelete');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            //updating the vtiger_users table
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            App\Db::getInstance()->createCommand()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    'status' => 'Inactive',
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * Function to get the user if of the active admin user.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                foreach ($users as $id => $user) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @return Users - Active Admin User Instance
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            App\Db::getInstance()->createCommand()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @param int   $userId
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * Transform owner ship and delete.
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                ], ['id' => $userId])->execute();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                        $adminId = $id;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                ->execute();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                return $cache->getAdminUserId();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $users = \App\PrivilegeFile::getUser('id');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $cache = Vtiger_Cache::getInstance();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $adminId = 1;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $user->retrieveCurrentUserInfoFromFile($adminId);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @return int - Active Admin User ID
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    $adminId = $result;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $adminId = self::getActiveAdminId();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    if ('Active' == $user['status'] && 'on' == $user['is_admin']) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    Line exceeds 120 characters; contains 143 characters
    Open

                $result = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['is_admin' => 'on', 'status' => 'Active'])->scalar();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $cache->setAdminUserId($adminId);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public static function getActiveAdminUser()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                ->update('vtiger_users', [
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            \App\UserPrivilegesFile::createUserPrivilegesfile($this->id);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         * @param array $transformToUserId
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public function transformOwnerShipAndDelete($userId, $transformToUserId)
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            return $user;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public function createAccessKey()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $eventHandler->trigger('UsersAfterDelete');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                $result = (new \App\Db\Query())->select(['id'])->from('vtiger_users')->where(['is_admin' => 'on', 'status' => 'Active'])->scalar();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            App\Fields\Owner::transferOwnership($userId, $transformToUserId);
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    'deleted' => 1,
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        public static function getActiveAdminId()
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                if ($result) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                ->update('vtiger_users', [
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $eventHandler = new App\EventHandler();
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            $eventHandler->setModuleName('Users');
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if ($cache->getAdminUserId()) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            if (App\Config::performance('ENABLE_CACHING_USERS')) {
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

            return $adminId;
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                    'accesskey' => \App\Encryption::generatePassword(20, 'lbn'),
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

                ], ['id' => $this->id])
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Users/Users.php by phpcodesniffer

    The variable $value_iter is not named in camelCase.
    Open

        public function retrieveCurrentUserInfoFromFile($userid)
        {
            $userPrivileges = App\User::getPrivilegesFile($userid);
            $userInfo = $userPrivileges['user_info'];
            foreach ($this->column_fields as $field => $value_iter) {
    Severity: Minor
    Found in modules/Users/Users.php by phpmd

    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