YetiForceCompany/YetiForceCRM

View on GitHub
app/Extension/PwnedPassword.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
42%

Method afterLogin has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function afterLogin(array $params): void
    {
        $file = ROOT_DIRECTORY . '/app_data/PwnedPassword.php';
        $userName = \App\Session::get('user_name');
        $config = \Settings_Password_Record_Model::getUserPassConfig();
Severity: Minor
Found in app/Extension/PwnedPassword.php - About 1 hr to fix

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

        public static function afterLogin(array $params): void
        {
            $file = ROOT_DIRECTORY . '/app_data/PwnedPassword.php';
            $userName = \App\Session::get('user_name');
            $config = \Settings_Password_Record_Model::getUserPassConfig();
    Severity: Minor
    Found in app/Extension/PwnedPassword.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 getProviders has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getProviders(): array
        {
            $return = [];
            foreach (new \DirectoryIterator(ROOT_DIRECTORY . '/app/Extension/PwnedPassword/') as $item) {
                if ($item->isFile() && 'Base' !== $item->getBasename('.php')) {
    Severity: Minor
    Found in app/Extension/PwnedPassword.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

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

        public static function afterLogin(array $params): void
        {
            $file = ROOT_DIRECTORY . '/app_data/PwnedPassword.php';
            $userName = \App\Session::get('user_name');
            $config = \Settings_Password_Record_Model::getUserPassConfig();
    Severity: Minor
    Found in app/Extension/PwnedPassword.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

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

            foreach (new \DirectoryIterator(ROOT_DIRECTORY . '/app/Extension/PwnedPassword/') as $item) {
    Severity: Minor
    Found in app/Extension/PwnedPassword.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 '62', column '14').
    Open

                throw new \App\Exceptions\AppException("ERR_CLASS_NOT_FOUND||{$className}");
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Process' in method 'usersAfterPasswordChange'.
    Open

            if (\App\Process::hasEvent('ShowUserPwnedPasswordChange')) {
    Severity: Minor
    Found in app/Extension/PwnedPassword.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 assigning values to variables in if clauses and the like (line '104', column '9').
    Open

        public static function afterLogin(array $params): void
        {
            $file = ROOT_DIRECTORY . '/app_data/PwnedPassword.php';
            $userName = \App\Session::get('user_name');
            $config = \Settings_Password_Record_Model::getUserPassConfig();
    Severity: Minor
    Found in app/Extension/PwnedPassword.php by phpmd

    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 '\Settings_Password_Record_Model' in method 'afterLogin'.
    Open

            $config = \Settings_Password_Record_Model::getUserPassConfig();
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Utils' in method 'afterLogin'.
    Open

                \App\Utils::saveToFile($file, $pwnedPassword, '', 0, true);
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Process' in method 'usersAfterPasswordChange'.
    Open

                \App\Process::removeEvent('ShowUserPwnedPasswordChange');
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Process' in method 'usersAfterLogin'.
    Open

                if (!\App\Process::hasEvent('ShowUserPwnedPasswordChange')) {
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Process' in method 'afterLogin'.
    Open

                \App\Process::addEvent([
                    'name' => 'ShowUserPwnedPasswordChange',
                    'priority' => 4,
                    'type' => 'modal',
                    'url' => 'index.php?module=Users&view=PasswordModal&mode=change&type=pwned&record=' . $params['userModel']->getId(),
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Utils' in method 'usersAfterPasswordChange'.
    Open

                \App\Utils::saveToFile($file, $pwnedPassword, '', 0, true);
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Session' in method 'usersAfterLogin'.
    Open

            if ('PASSWORD' === \App\Session::get('UserAuthMethod')) {
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Session' in method 'afterLogin'.
    Open

            $userName = \App\Session::get('user_name');
    Severity: Minor
    Found in app/Extension/PwnedPassword.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 'getDefaultProvider'.
    Open

            $className = '\\App\\Extension\\PwnedPassword\\' . \App\Config::module('Users', 'pwnedPasswordProvider');
    Severity: Minor
    Found in app/Extension/PwnedPassword.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\Process' in method 'afterLogin'.
    Open

                    \App\Process::addEvent([
                        'name' => 'ShowUserPwnedPasswordChange',
                        'priority' => 4,
                        'type' => 'modal',
                        'url' => 'index.php?module=Users&view=PasswordModal&mode=change&type=pwned&record=' . $params['userModel']->getId(),
    Severity: Minor
    Found in app/Extension/PwnedPassword.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 "status" 5 times.
    Open

                if (($passStatus = self::check($params['password'])) && !$passStatus['status']) {
    Severity: Critical
    Found in app/Extension/PwnedPassword.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 "ShowUserPwnedPasswordChange" 5 times.
    Open

                if (!\App\Process::hasEvent('ShowUserPwnedPasswordChange')) {
    Severity: Critical
    Found in app/Extension/PwnedPassword.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 "userModel" 3 times.
    Open

                    $eventHandler->getRecordModel()->verifyPasswordChange($params['userModel']);
    Severity: Critical
    Found in app/Extension/PwnedPassword.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 "dates" 3 times.
    Open

            if (empty($pwnedPassword['dates'][$userName]) || strtotime($pwnedPassword['dates'][$userName]) < strtotime("-$time day")) {
    Severity: Critical
    Found in app/Extension/PwnedPassword.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.

    Doc-block of $eventHandler in usersAfterLogin contains phpdoc param type \App\Extension\App\EventHandler which is incompatible with the param type \App\EventHandler declared in the signature
    Open

         * @param App\EventHandler $eventHandler
    Severity: Minor
    Found in app/Extension/PwnedPassword.php by phan

    Doc-block of $eventHandler in usersAfterPasswordChange contains phpdoc param type \App\Extension\App\EventHandler which is incompatible with the param type \App\EventHandler declared in the signature
    Open

         * @param App\EventHandler $eventHandler
    Severity: Minor
    Found in app/Extension/PwnedPassword.php by phan

    Call to undeclared method \Vtiger_Record_Model::verifyPasswordChange
    Open

                    $eventHandler->getRecordModel()->verifyPasswordChange($params['userModel']);
    Severity: Critical
    Found in app/Extension/PwnedPassword.php by phan

    Invalid offset "dates" of array type array{}
    Open

            if (empty($pwnedPassword['dates'][$userName]) || strtotime($pwnedPassword['dates'][$userName]) < strtotime("-$time day")) {
    Severity: Minor
    Found in app/Extension/PwnedPassword.php by phan

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

            }

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

        /**

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

         *

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

        }

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

         * Get all providers.

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

        {

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

                    $fileName = $item->getBasename('.php');

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

        public static function getDefaultProvider(): PwnedPassword\Base

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

         * @param App\EventHandler $eventHandler

    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 afterLogin(array $params): void

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

                return;

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

         * Check the password function.

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

         *

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

            return self::getDefaultProvider()->check($password);

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

            $return = [];

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

            foreach (new \DirectoryIterator(ROOT_DIRECTORY . '/app/Extension/PwnedPassword/') as $item) {

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

                    $instance = new $className();

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

                    $eventHandler->getRecordModel()->verifyPasswordChange($params['userModel']);

    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\Extension\PwnedPassword\Base

    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

                        'type' => 'modal',

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

                        'url' => 'index.php?module=Users&view=PasswordModal&mode=change&type=pwned&record=' . $params['userModel']->getId(),

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

                    ]);

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

                if ($item->isFile() && 'Base' !== $item->getBasename('.php')) {

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

                        $return[$fileName] = $instance;

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

                self::afterLogin($params);

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

        /**

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

         *

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

                    }

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

            $file = ROOT_DIRECTORY . '/app_data/PwnedPassword.php';

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

            if ('false' === $config['pwned'] || !$time) {

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

            } elseif (isset($pwnedPassword['status'][$userName]) && true === $pwnedPassword['status'][$userName]) {

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

            return $return;

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

         *

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

            return new $className();

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

            if ('PASSWORD' === \App\Session::get('UserAuthMethod')) {

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

         * Check the password after login.

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

                    $pwnedPassword['status'][$userName] = true;

    Line exceeds 120 characters; contains 136 characters
    Open

                        'url' => 'index.php?module=Users&view=PasswordModal&mode=change&type=pwned&record=' . $params['userModel']->getId(),

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

                    'url' => 'index.php?module=Users&view=PasswordModal&mode=change&type=pwned&record=' . $params['userModel']->getId(),

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

            }

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

                throw new \App\Exceptions\AppException("ERR_CLASS_NOT_FOUND||{$className}");

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

        }

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

         *

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

        {

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

                ]);

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

        /**

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

        public static function check(string $password): 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

         * Get default provider.

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

                }

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

                    'name' => 'ShowUserPwnedPasswordChange',

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

         * @return array ['message' => (string) , 'status' => (bool)]

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

                    if($instance->isActive()){

    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\Process::hasEvent('ShowUserPwnedPasswordChange')) {

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

            $className = '\\App\\Extension\\PwnedPassword\\' . \App\Config::module('Users', 'pwnedPasswordProvider');

    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 void

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

            $time = (int) $config['pwned_time'] ?? 0;

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

                        'priority' => 4,

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

                $pwnedPassword['dates'][$userName] = date('Y-m-d H:i:s');

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

                \App\Utils::saveToFile($file, $pwnedPassword, '', 0, true);

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

         * @param string $password

    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 getProviders(): 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

            $userName = \App\Session::get('user_name');

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

            $config = \Settings_Password_Record_Model::getUserPassConfig();

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

            if (file_exists($file)) {

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

                $pwnedPassword = require $file;

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

                \App\Process::addEvent([

    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 (!class_exists($className)) {

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

        public function usersAfterLogin(\App\EventHandler $eventHandler): void

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

         * @param array $params

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

            $pwnedPassword = [];

    Line exceeds 120 characters; contains 131 characters
    Open

            if (empty($pwnedPassword['dates'][$userName]) || strtotime($pwnedPassword['dates'][$userName]) < strtotime("-$time day")) {

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

         * @return \App\Extension\PwnedPassword\Base[]

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

            }

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

         * UsersAfterLogin handler function.

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

         */

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

            }

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

            if (empty($pwnedPassword['dates'][$userName]) || strtotime($pwnedPassword['dates'][$userName]) < strtotime("-$time day")) {

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

                if (($passStatus = self::check($params['password'])) && !$passStatus['status']) {

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

                    \App\Process::addEvent([

    Line exceeds 120 characters; contains 132 characters
    Open

                    'url' => 'index.php?module=Users&view=PasswordModal&mode=change&type=pwned&record=' . $params['userModel']->getId(),

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

        {

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

                        'name' => 'ShowUserPwnedPasswordChange',

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

                    'priority' => 4,

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

                    'type' => 'modal',

    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

                    $className = "\\App\\Extension\\PwnedPassword\\$fileName";

    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

                $params = $eventHandler->getParams();

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

            }

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

                unset($pwnedPassword['status'][$eventHandler->getRecordModel()->get('user_name')]);

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

         * @param App\EventHandler $eventHandler

    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\Utils::saveToFile($file, $pwnedPassword, '', 0, true);

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

        public function usersAfterPasswordChange(\App\EventHandler $eventHandler): void

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

            if (file_exists($file)) {

    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

            $file = ROOT_DIRECTORY . '/app_data/PwnedPassword.php';

    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

         * UsersAfterPasswordChange handler function.

    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\Process::removeEvent('ShowUserPwnedPasswordChange');

    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\Process::hasEvent('ShowUserPwnedPasswordChange')) {

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

                $pwnedPassword = require $file;

    Expected 1 space after closing parenthesis; found 0
    Open

                    if($instance->isActive()){

    Expected 1 space after IF keyword; 0 found
    Open

                    if($instance->isActive()){

    There are no issues that match your filters.

    Category
    Status