sam002/yii2-otp

View on GitHub
src/helpers/OtpHelper.php

Summary

Maintainability
A
1 hr
Test Coverage

Method getHotp has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function getHotp($label = '', $digits = 6, $digest = 'sha1', $counter = 0, $issuer='')
Severity: Minor
Found in src/helpers/OtpHelper.php - About 35 mins to fix

    Method getTotp has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function getTotp($label = '', $digits = 6, $digest = 'sha1', $interval = 30, $issuer='')
    Severity: Minor
    Found in src/helpers/OtpHelper.php - About 35 mins to fix

      Avoid using static access to class '\ParagonIE\ConstantTime\Base32' in method 'generateSecret'.
      Open

              $full = Base32::encode($security->generateRandomString($length));
      Severity: Minor
      Found in src/helpers/OtpHelper.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

      Incorrect spacing between default value and equals sign for argument "$issuer"; expected 1 but found 0
      Open

          public static function getTotp($label = '', $digits = 6, $digest = 'sha1', $interval = 30, $issuer='')
      Severity: Minor
      Found in src/helpers/OtpHelper.php by phpcodesniffer

      Incorrect spacing between default value and equals sign for argument "$issuer"; expected 1 but found 0
      Open

          public static function getHotp($label = '', $digits = 6, $digest = 'sha1', $counter = 0, $issuer='')
      Severity: Minor
      Found in src/helpers/OtpHelper.php by phpcodesniffer

      Incorrect spacing between argument "$issuer" and equals sign; expected 1 but found 0
      Open

          public static function getHotp($label = '', $digits = 6, $digest = 'sha1', $counter = 0, $issuer='')
      Severity: Minor
      Found in src/helpers/OtpHelper.php by phpcodesniffer

      Incorrect spacing between argument "$issuer" and equals sign; expected 1 but found 0
      Open

          public static function getTotp($label = '', $digits = 6, $digest = 'sha1', $interval = 30, $issuer='')
      Severity: Minor
      Found in src/helpers/OtpHelper.php by phpcodesniffer

      Expected 1 space after IF keyword; 0 found
      Open

              if(!empty($issuer)) {
      Severity: Minor
      Found in src/helpers/OtpHelper.php by phpcodesniffer

      Expected 1 space after IF keyword; 0 found
      Open

              if(!empty($issuer)) {
      Severity: Minor
      Found in src/helpers/OtpHelper.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status