eustasy/authenticatron

View on GitHub

Showing 10 of 10 total issues

File documentation.php has 403 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

require_once __DIR__ . '/vendor/autoload.php';
use eustasy\Authenticatron;

Severity: Minor
Found in documentation.php - About 5 hrs to fix

    The method new uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $return['URL'] = self::getUrl($accountName, $return['Secret'], $issuer);
                $return['QR'] = self::generateQrCode($return['URL']);
                // WARNING QR returns null if not available
            }
    Severity: Minor
    Found in src/authenticatron.php by phpmd

    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

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 16
    Open

                    if (Authenticatron::checkCode($_POST['secondfactor_code'], $secret)) {
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 16
    Open

                    } else {
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            if (!empty($_POST['secondfactor_code'])) {
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 16
    Open

                    }
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } else {
    Severity: Minor
    Found in index.php by phpcodesniffer

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }
    Severity: Minor
    Found in index.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language