YetiForceCompany/YetiForceCRM

View on GitHub
modules/Users/authmethods/Totp.php

Summary

Maintainability
A
35 mins
Test Coverage
F
38%

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

    public static function isActive($userId = null)
    {
        $isActive = false;
        if (empty($userId)) {
            $userId = \App\User::getCurrentUserRealId();
Severity: Minor
Found in modules/Users/authmethods/Totp.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

Missing class import via use statement (line '45', column '30').
Open

        $this->authenticator = new \PragmaRX\Google2FA\Google2FA();
Severity: Minor
Found in modules/Users/authmethods/Totp.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 '87', column '26').
Open

        $qrCodeGenerator = new \Milon\Barcode\DNS2D();
Severity: Minor
Found in modules/Users/authmethods/Totp.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 '99', column '13').
Open

        throw new \App\Exceptions\NotAllowedMethod('LBL_NOT_EXIST: ' . $type);
Severity: Minor
Found in modules/Users/authmethods/Totp.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\Config' in method 'isActive'.
Open

            switch (App\Config::security('USER_AUTHY_MODE')) {
Severity: Minor
Found in modules/Users/authmethods/Totp.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 'createQrCode'.
Open

        $qrCodeGenerator->setStorPath(__DIR__ . App\Config::main('tmp_dir'));
Severity: Minor
Found in modules/Users/authmethods/Totp.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 'isActive'.
Open

            $userId = \App\User::getCurrentUserRealId();
Severity: Minor
Found in modules/Users/authmethods/Totp.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 'getOtpAuthUrl'.
Open

            $issuer = parse_url(App\Config::main('site_URL'))['host'] ?? '';
Severity: Minor
Found in modules/Users/authmethods/Totp.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 'isActive'.
Open

        $userModel = \App\User::getUserModel($userId);
Severity: Minor
Found in modules/Users/authmethods/Totp.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 'mustInit'.
Open

            $userId = \App\User::getCurrentUserRealId();
Severity: Minor
Found in modules/Users/authmethods/Totp.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 "QRCODE" 3 times.
Open

                return $qrCodeGenerator->getBarcodeHTML($otpAuthUrl, 'QRCODE');
Severity: Critical
Found in modules/Users/authmethods/Totp.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.

Property \Users_Totp_Authmethod->authenticator has undeclared type \PragmaRX\Google2FA\Google2FA
Open

    private $authenticator;
Severity: Minor
Found in modules/Users/authmethods/Totp.php by phan

Call to method setStorPath from undeclared class \Milon\Barcode\DNS2D
Open

        $qrCodeGenerator->setStorPath(__DIR__ . App\Config::main('tmp_dir'));
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method getBarcodePNG from undeclared class \Milon\Barcode\DNS2D
Open

                return '<img src="data:image/png;base64,' . $qrCodeGenerator->getBarcodePNG($otpAuthUrl, 'QRCODE', 10, 10) . '" alt="QR code" class="col-auto p-0" />';
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method getQRCodeUrl from undeclared class \PragmaRX\Google2FA\Google2FA
Open

        return $this->authenticator->getQRCodeUrl($issuer, $name, $secret);
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Return type of createQrCode() is undeclared type \Milon\Barcode\path
Open

    private function createQrCode($otpAuthUrl, $type = 'HTML')
Severity: Minor
Found in modules/Users/authmethods/Totp.php by phan

Call to method verifyKey from undeclared class \PragmaRX\Google2FA\Google2FA
Open

        return $this->authenticator->verifyKey($secret, (string) $userCode);
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method generateSecretKey from undeclared class \PragmaRX\Google2FA\Google2FA
Open

        return $this->secret = $this->authenticator->generateSecretKey();
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method __construct from undeclared class \Milon\Barcode\DNS2D
Open

        $qrCodeGenerator = new \Milon\Barcode\DNS2D();
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Return type of createQrCodeForUser() is undeclared type \Milon\Barcode\path
Open

    public function createQrCodeForUser($type = 'PNG')
Severity: Minor
Found in modules/Users/authmethods/Totp.php by phan

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

        return $this->createQrCode($this->getOtpAuthUrl($this->secret, \App\User::getUserModel($this->userId)->getDetail('user_name')), $type);
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method __construct from undeclared class \PragmaRX\Google2FA\Google2FA
Open

        $this->authenticator = new \PragmaRX\Google2FA\Google2FA();
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method getBarcodeSVG from undeclared class \Milon\Barcode\DNS2D
Open

                return $qrCodeGenerator->getBarcodeSVG($otpAuthUrl, 'QRCODE');
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method getBarcodeHTML from undeclared class \Milon\Barcode\DNS2D
Open

                return $qrCodeGenerator->getBarcodeHTML($otpAuthUrl, 'QRCODE');
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

Call to method getCurrentOtp from undeclared class \PragmaRX\Google2FA\Google2FA
Open

        return $this->authenticator->getCurrentOtp($this->secret);
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

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

            $userId = \App\User::getCurrentUserRealId();
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

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

        $userModel = \App\User::getUserModel($userId);
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

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

            $userId = \App\User::getCurrentUserRealId();
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

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

        return empty(\App\User::getUserModel($userId)->getDetail('authy_secret_totp'));
Severity: Critical
Found in modules/Users/authmethods/Totp.php by phan

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

class Users_Totp_Authmethod

The class Users_Totp_Authmethod is not named in CamelCase.
Open

class Users_Totp_Authmethod
{
    /**
     * @var string[] User authentication mode possible values.
     *               TOTP_OFF - 2FA TOTP is checking off
Severity: Minor
Found in modules/Users/authmethods/Totp.php by phpmd

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

    /** @var string - Secret code */

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

     * @param string      $name   - The name is used to identify which account a key is associated with.

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

    {

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

    }

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

    /**

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

    /** @var \PragmaRX\Google2FA\Google2FA */

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

     * @var string[] User authentication mode possible values.

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

    /**

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

    public function getOtpAuthUrl($secret, $name, $issuer = null)

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

     *               TOTP_OPTIONAL - It is defined by the user

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

     *               TOTP_OBLIGATORY - It is obligatory.

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

    private $authenticator;

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

     *               TOTP_OFF - 2FA TOTP is checking off

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|null $issuer - The issuer parameter is a string value indicating the provider or service this account is associated with, URL-encoded according to RFC 3986.

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

        $this->authenticator = new \PragmaRX\Google2FA\Google2FA();

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

            $issuer = parse_url(App\Config::main('site_URL'))['host'] ?? '';

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

    }

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

     */

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

        return $this->authenticator->getQRCodeUrl($issuer, $name, $secret);

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

        if (null === $issuer) {

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

    const ALLOWED_USER_AUTHY_MODE = ['TOTP_OFF', 'TOTP_OPTIONAL', 'TOTP_OBLIGATORY'];

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

    private $userId;

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

        $this->userId = $userId;

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

     * Generate TOTP code url.

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

     *

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

    private $secret;

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

     * Constructor.

Line exceeds 120 characters; contains 218 characters
Open

     * @param string      $secret - REQUIRED: The secret parameter is an arbitrary key value encoded in Base32 according to RFC 3548. The padding specified in RFC 3548 section 2.2 is not required and should be omitted.

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

     *

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

    public function __construct(int $userId)

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

        }

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

    /** @var int - User id */

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

     */

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

     * @param string      $secret - REQUIRED: The secret parameter is an arbitrary key value encoded in Base32 according to RFC 3548. The padding specified in RFC 3548 section 2.2 is not required and should be omitted.

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

    /**

Line exceeds 120 characters; contains 177 characters
Open

     * @param string|null $issuer - The issuer parameter is a string value indicating the provider or service this account is associated with, URL-encoded according to RFC 3986.

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

     * @return string - Url

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

     * @param int $userId - Id of user

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

     * @return string

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

     * @return \Milon\Barcode\path|string - HTML code

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

     */

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

        $qrCodeGenerator->setStorPath(__DIR__ . App\Config::main('tmp_dir'));

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

        switch ($type) {

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

            default:

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

     * Creating a secret code for TOTP.

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

    }

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

     * @throws \App\Exceptions\NotAllowedMethod

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

    public function createQrCodeForUser($type = 'PNG')

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

        $isActive = false;

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

                    break;

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

    public function createSecret()

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

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

                    break;

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

                    break;

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

                    $isActive = true;

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

     *

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

        }

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

    /**

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

        return $this->authenticator->getCurrentOtp($this->secret);

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

     *

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

            $userId = \App\User::getCurrentUserRealId();

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

        $userModel = \App\User::getUserModel($userId);

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

            switch (App\Config::security('USER_AUTHY_MODE')) {

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

    public static function mustInit($userId = null)

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

            case 'PNG':

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

     * @return \Milon\Barcode\path|string

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

    {

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

        return $this->createQrCode($this->getOtpAuthUrl($this->secret, \App\User::getUserModel($this->userId)->getDetail('user_name')), $type);

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

    public function verifyCode($secret, $userCode)

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

     * Determine whether 2FA is required.

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

                default:

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

        }

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

            $userId = \App\User::getCurrentUserRealId();

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

            case 'HTML':

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 $qrCodeGenerator->getBarcodeSVG($otpAuthUrl, 'QRCODE');

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

                return $qrCodeGenerator->getBarcodeHTML($otpAuthUrl, 'QRCODE');

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

     */

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

                case 'TOTP_OPTIONAL':

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

        }

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

     * Check if 2FA initiation is necessary.

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

     * @param string $type - acceptable types [HTML, SVG, PNG]

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 '<img src="data:image/png;base64,' . $qrCodeGenerator->getBarcodePNG($otpAuthUrl, 'QRCODE', 10, 10) . '" alt="QR code" class="col-auto p-0" />';

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

     * @param int|null $userId - if null then getCurrentUserRealId

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

        return $this->createQrCode($this->getOtpAuthUrl($this->secret, \App\User::getUserModel($this->userId)->getDetail('user_name')), $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

     * @param string $userCode

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 ('PLL_PASSWORD_2FA' === $userModel->getDetail('login_method') || 'PLL_LDAP_2FA' === $userModel->getDetail('login_method')) {

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

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 isActive($userId = null)

Line exceeds 120 characters; contains 135 characters
Open

        if ('PLL_PASSWORD_2FA' === $userModel->getDetail('login_method') || 'PLL_LDAP_2FA' === $userModel->getDetail('login_method')) {

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 empty(\App\User::getUserModel($userId)->getDetail('authy_secret_totp'));

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

     *

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

     *

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

     *

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

    {

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

    }

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

     */

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

    {

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

     * @throws \App\Exceptions\NotAllowedMethod

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

    private function createQrCode($otpAuthUrl, $type = 'HTML')

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

     * @param int|null $userId - if null then getCurrentUserRealId

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

     * @param string $type       - acceptable types [HTML, SVG, PNG]

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

     */

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

        return $this->authenticator->verifyKey($secret, (string) $userCode);

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

                    $isActive = 'PLL_AUTHY_TOTP' === $userModel->getDetail('authy_methods');

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

        return $isActive;

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

        if (empty($userId)) {

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

            case 'SVG':

Line exceeds 120 characters; contains 167 characters
Open

                return '<img src="data:image/png;base64,' . $qrCodeGenerator->getBarcodePNG($otpAuthUrl, 'QRCODE', 10, 10) . '" alt="QR code" class="col-auto p-0" />';

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

     * 2FA - verification of the code from the user.

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

     *

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

     * 2FA - get the current one time password.

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

                case 'TOTP_OBLIGATORY':

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

     */

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

        return $this->secret = $this->authenticator->generateSecretKey();

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

     * Create QR code.

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

    {

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

     * Create QR code for user.

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

     */

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

     * @return bool

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

    {

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

        if (empty($userId)) {

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

            }

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

        $qrCodeGenerator = new \Milon\Barcode\DNS2D();

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

                break;

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

        throw new \App\Exceptions\NotAllowedMethod('LBL_NOT_EXIST: ' . $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

     * @return string

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

    public function getCode(): string

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

class Users_Totp_Authmethod

There are no issues that match your filters.

Category
Status