YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
B
5 hrs
Test Coverage
F
34%

Consider simplifying this complex logical expression.
Open

        if ('min_length' == $type) {
            $returnVal = is_numeric($vale) && (int) $vale <= (int) static::getUserPassConfig('max_length');
        } elseif ('max_length' == $type) {
            $returnVal = is_numeric($vale) && (int) $vale >= (int) static::getUserPassConfig('min_length');
        } elseif ('change_time' == $type || 'lock_time' == $type || 'pwned_time' == $type) {
Severity: Critical
Found in modules/Settings/Password/models/Record.php - About 2 hrs to fix

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

        public static function checkPassword($pass)
        {
            $conf = self::getUserPassConfig();
            $moduleName = 'Settings:Password';
            if (\strlen($pass) > $conf['max_length']) {
    Severity: Minor
    Found in modules/Settings/Password/models/Record.php - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function validation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function validation(string $type, string $vale): bool
        {
            $returnVal = false;
            if ('min_length' == $type) {
                $returnVal = is_numeric($vale) && (int) $vale <= (int) static::getUserPassConfig('max_length');
    Severity: Minor
    Found in modules/Settings/Password/models/Record.php - About 35 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid too many return statements within this method.
    Open

                return \App\Language::translate('Password should contain special characters', $moduleName);
    Severity: Major
    Found in modules/Settings/Password/models/Record.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $passStatus['message'];
      Severity: Major
      Found in modules/Settings/Password/models/Record.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return false;
        Severity: Major
        Found in modules/Settings/Password/models/Record.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return \App\Language::translate('Lowercase letters a to z', $moduleName);
          Severity: Major
          Found in modules/Settings/Password/models/Record.php - About 30 mins to fix

            The method checkPassword() has an NPath complexity of 1296. The configured NPath complexity threshold is 200.
            Open

                public static function checkPassword($pass)
                {
                    $conf = self::getUserPassConfig();
                    $moduleName = 'Settings:Password';
                    if (\strlen($pass) > $conf['max_length']) {

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

                public static function checkPassword($pass)
                {
                    $conf = self::getUserPassConfig();
                    $moduleName = 'Settings:Password';
                    if (\strlen($pass) > $conf['max_length']) {

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function validation(string $type, string $vale): bool
                {
                    $returnVal = false;
                    if ('min_length' == $type) {
                        $returnVal = is_numeric($vale) && (int) $vale <= (int) static::getUserPassConfig('max_length');

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function checkPassword($pass)

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

            Noncompliant Code Example

            With the default threshold of 3:

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

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_password')->createCommand()->query();

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                    $modules = (new \App\Db\Query())->select(['vtiger_tab.tabid', 'vtiger_tab.name'])->from('vtiger_field')

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                public static function getUserPassConfig($type = false)

            BooleanArgumentFlag

            Since: 1.4.0

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

            Example

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

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

            Avoid assigning values to variables in if clauses and the like (line '91', column '36').
            Open

                public static function checkPassword($pass)
                {
                    $conf = self::getUserPassConfig();
                    $moduleName = 'Settings:Password';
                    if (\strlen($pass) > $conf['max_length']) {

            IfStatementAssignment

            Since: 2.7.0

            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

            Example

            class Foo
            {
                public function bar($flag)
                {
                    if ($foo = 'bar') { // possible typo
                        // ...
                    }
                    if ($baz = 0) { // always false
                        // ...
                    }
                }
            }

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

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

                        return \App\Language::translate('Maximum password length', $moduleName) . ' ' . $conf['max_length'] . ' ' . \App\Language::translate('characters', $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Password should contain numbers', $moduleName);

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

                        if (null === \App\Config::module($moduleName, 'encryptionMethod', null) || null === \App\Config::module($moduleName, 'encryptionPass', null)) {

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Cache' in method 'setPassDetail'.
            Open

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

            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\Extension\PwnedPassword' in method 'checkPassword'.
            Open

                    if ('true' == $conf['pwned'] && ($passStatus = App\Extension\PwnedPassword::check($pass)) && !$passStatus['status']) {

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Minimum password length', $moduleName) . ' ' . $conf['min_length'] . ' ' . \App\Language::translate('characters', $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Minimum password length', $moduleName) . ' ' . $conf['min_length'] . ' ' . \App\Language::translate('characters', $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Password should contain special characters', $moduleName);

            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\Date' in method 'getPasswordChangeDateCondition'.
            Open

                        $date = \App\Fields\Date::formatToDisplay($date);

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

                    } else {
                        $dataReader = (new \App\Db\Query())->from('vtiger_password')->createCommand()->query();
                        $detail = [];
                        while ($row = $dataReader->read()) {
                            $detail[$row['type']] = $row['val'];

            ElseExpression

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Cache' in method 'getUserPassConfig'.
            Open

                    if (\App\Cache::has('PasswordConfig', '')) {

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Cache' in method 'getUserPassConfig'.
            Open

                        \App\Cache::save('PasswordConfig', '', $detail);

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

                        if (null === \App\Config::module($moduleName, 'encryptionMethod', null) || null === \App\Config::module($moduleName, 'encryptionPass', null)) {

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Cache' in method 'getUserPassConfig'.
            Open

                        $detail = \App\Cache::get('PasswordConfig', '');

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Uppercase letters from A to Z', $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Lowercase letters a to z', $moduleName);

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        return \App\Language::translate('Maximum password length', $moduleName) . ' ' . $conf['max_length'] . ' ' . \App\Language::translate('characters', $moduleName);

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

                        $returnVal = is_numeric($vale) && (int) $vale <= (int) static::getUserPassConfig('max_length');

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

                    if ('min_length' == $type) {

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

                    if (\App\Cache::has('PasswordConfig', '')) {

            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.

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

                    $modules = (new \App\Db\Query())->select(['vtiger_tab.tabid', 'vtiger_tab.name'])->from('vtiger_field')

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

                    App\Db::getInstance()->createCommand()

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_password')->createCommand()->query();

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

            class Settings_Password_Record_Model extends Vtiger_Record_Model

            The class Settings_Password_Record_Model is not named in CamelCase.
            Open

            class Settings_Password_Record_Model extends Vtiger_Record_Model
            {
                /**
                 * Get user password configuration.
                 *

            CamelCaseClassName

            Since: 0.2

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

            Example

            class class_name {
            }

            Source

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

                /**

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

                 *

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

                    if (\App\Cache::has('PasswordConfig', '')) {

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

                    } else {

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

                        $dataReader = (new \App\Db\Query())->from('vtiger_password')->createCommand()->query();

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

                 *

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

                public static function getUserPassConfig($type = false)

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

                 *

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

                    if ('min_length' == $type) {

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

                public static function checkPassword($pass)

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

                    }

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

                        return \App\Language::translate('Password should contain special characters', $moduleName);

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

                /**

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

                 *

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

                public static function getEncryptionModules(): array

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

                        ->where(['vtiger_tab.presence' => 0, 'vtiger_tab.isentitytype' => 1, 'vtiger_field.uitype' => 99, 'vtiger_field.presence' => [0, 2]])->createCommand()->queryAllByGroup(0);

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

                 */

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

                        ->execute();

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

                }

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

                /**

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

                 * @param string $type

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

                 * @param string $vale

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

                    $returnVal = false;

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

                }

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

                    $moduleName = 'Settings:Password';

            Line exceeds 120 characters; contains 126 characters
            Open

                    if ('true' == $conf['pwned'] && ($passStatus = App\Extension\PwnedPassword::check($pass)) && !$passStatus['status']) {

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

                 * @return bool

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

                {

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

                }

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

                }

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

                        $returnVal = is_numeric($vale) && (int) $vale <= (int) static::getUserPassConfig('max_length');

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

                    } elseif ('max_length' == $type) {

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

                    if ('true' == $conf['big_letters'] && !preg_match('#[A-Z]+#', $pass)) {

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

                        return \App\Language::translate('Uppercase letters from A to Z', $moduleName);

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

                    if ('true' == $conf['pwned'] && ($passStatus = App\Extension\PwnedPassword::check($pass)) && !$passStatus['status']) {

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

                    $passConfig = static::getUserPassConfig();

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

                /**

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

                {

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

                public static function setPassDetail($type, $vale)

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

                {

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

                    App\Db::getInstance()->createCommand()

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

                    } elseif ('change_time' == $type || 'lock_time' == $type || 'pwned_time' == $type) {

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

                    $conf = self::getUserPassConfig();

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

                    }

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

                    }

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

                        return \App\Language::translate('Lowercase letters a to z', $moduleName);

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

                }

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

                    $delayDays = $passConfig['change_time'];

            Line exceeds 120 characters; contains 183 characters
            Open

                        ->where(['vtiger_tab.presence' => 0, 'vtiger_tab.isentitytype' => 1, 'vtiger_field.uitype' => 99, 'vtiger_field.presence' => [0, 2]])->createCommand()->queryAllByGroup(0);

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

                        $detail = [];

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

                        $returnVal = is_numeric($vale);

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

                    } elseif ('big_letters' == $type || 'small_letters' == $type || 'numbers' == $type || 'special' == $type || 'pwned' == $type) {

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

                    }

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

                {

            Line exceeds 120 characters; contains 155 characters
            Open

                        if (null === \App\Config::module($moduleName, 'encryptionMethod', null) || null === \App\Config::module($moduleName, 'encryptionPass', null)) {

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

                 * @return array|string

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

                        return \App\Language::translate('Maximum password length', $moduleName) . ' ' . $conf['max_length'] . ' ' . \App\Language::translate('characters', $moduleName);

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

                    }

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

                 * @return array

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

                 * Get user password configuration.

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

                        \App\Cache::save('PasswordConfig', '', $detail);

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

                 *

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

                    return $returnVal;

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

                        return \App\Language::translate('Password should contain numbers', $moduleName);

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

                    }

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

                 *

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

                 * Gets encryption modules.

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

                        }

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

                    }

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

                    return $type ? $detail[$type] : $detail;

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

                 * Validation.

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

                public static function validation(string $type, string $vale): bool

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

                    if (\strlen($pass) > $conf['max_length']) {

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

                    if ('true' == $conf['numbers'] && !preg_match('#[0-9]+#', $pass)) {

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

                 */

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

                        $detail = \App\Cache::get('PasswordConfig', '');

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

                            $detail[$row['type']] = $row['val'];

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

                        $dataReader->close();

            Line exceeds 120 characters; contains 172 characters
            Open

                        return \App\Language::translate('Maximum password length', $moduleName) . ' ' . $conf['max_length'] . ' ' . \App\Language::translate('characters', $moduleName);

            Line exceeds 120 characters; contains 172 characters
            Open

                        return \App\Language::translate('Minimum password length', $moduleName) . ' ' . $conf['min_length'] . ' ' . \App\Language::translate('characters', $moduleName);

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

                    if ('true' == $conf['special'] && !preg_match('~[!"#$%&\'()*+,-./:;<=>?@[\]^_{|}]~', $pass)) {

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

                {

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

                        $date = \App\Fields\Date::formatToDisplay($date);

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

                        ->innerJoin('vtiger_tab', 'vtiger_field.tabid=vtiger_tab.tabid')

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

                        }

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

                    if (\strlen($pass) < $conf['min_length']) {

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

                        return $passStatus['message'];

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

                 * @return array

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

                    }

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

                    return $modules;

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

                 * @param string|bool $type

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

                    if ('true' == $conf['small_letters'] && !preg_match('#[a-z]+#', $pass)) {

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

                    }

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

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

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

                    $conditions = [['force_password_change', 'e', '1']];

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

                }

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

                        $returnVal = 'false' === $vale || 'true' === $vale;

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

                        return \App\Language::translate('Minimum password length', $moduleName) . ' ' . $conf['min_length'] . ' ' . \App\Language::translate('characters', $moduleName);

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

                    return false;

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

                 * Get conditions for password modification.

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

                    $date = null;

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

                    foreach ($modules as $key => $moduleName) {

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

                            unset($modules[$key]);

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

                        ->update('vtiger_password', ['val' => $vale], ['type' => $type])

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

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

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

                        $returnVal = is_numeric($vale) && (int) $vale >= (int) static::getUserPassConfig('min_length');

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

                    }

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

                {

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

                public static function getPasswordChangeDateCondition(): array

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

                    if (!empty($delayDays)) {

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

                        $conditions[] = ['date_password_change', 'b', $date];

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

                    }

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

                 */

            Line exceeds 120 characters; contains 135 characters
            Open

                    } elseif ('big_letters' == $type || 'small_letters' == $type || 'numbers' == $type || 'special' == $type || 'pwned' == $type) {

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

                        $date = date('Y-m-d', strtotime("-{$delayDays} day"));

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

                    return [[[]], $conditions];

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

                 */

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

                    $modules = (new \App\Db\Query())->select(['vtiger_tab.tabid', 'vtiger_tab.name'])->from('vtiger_field')

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

                        if (null === \App\Config::module($moduleName, 'encryptionMethod', null) || null === \App\Config::module($moduleName, 'encryptionPass', null)) {

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

            class Settings_Password_Record_Model extends Vtiger_Record_Model

            There are no issues that match your filters.

            Category
            Status