sam002/yii2-otp

View on GitHub

Showing 9 of 53 total issues

File OtpInit.php has 268 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Author: Semen Dubina
 * Date: 20.01.16
 * Time: 4:22
Severity: Minor
Found in src/widgets/OtpInit.php - About 2 hrs to fix

    Method initQr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function initQr($text)
        {
    
            $level = ErrorCorrectionLevelInterface::QUARTILE;
            $type = PngWriter::class;
    Severity: Minor
    Found in src/widgets/OtpInit.php - About 1 hr to fix

      Method decorateQr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function decorateQr(QrCode $qrCode)
          {
      
              $foreColor = [0,0,0];
              $backColor = [255,255,255];
      Severity: Minor
      Found in src/widgets/OtpInit.php - About 1 hr to fix

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

            public function init()
            {
                parent::init();
                if ($this->algorithm === self::ALGORITHM_TOTP) {
                    $this->otp = OtpHelper::getTotp($this->label, $this->digits, $this->digest, $this->interval, $this->issuer);
        Severity: Minor
        Found in src/Otp.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

        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

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

                private function initQr($text)
                {
            
                    $level = ErrorCorrectionLevelInterface::QUARTILE;
                    $type = PngWriter::class;
            Severity: Minor
            Found in src/widgets/OtpInit.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

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

                private function decorateQr(QrCode $qrCode)
                {
            
                    $foreColor = [0,0,0];
                    $backColor = [255,255,255];
            Severity: Minor
            Found in src/widgets/OtpInit.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

            Function checkParamOutfile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                private function checkParamOutfile($outfile)
                {
                    if(is_string($outfile) && !is_dir(dirname($outfile))) {
                        throw new InvalidConfigException('OtpInit::$qrParams[\'outfile\'] error ' . dirname($outfile) . ' is not dir');
                    } elseif (!is_string($outfile) && $outfile !== false) {
            Severity: Minor
            Found in src/widgets/OtpInit.php - About 25 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

            Severity
            Category
            Status
            Source
            Language