Showing 10 of 10 total issues
File documentation.php
has 403 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
require_once __DIR__ . '/vendor/autoload.php';
use eustasy\Authenticatron;
The method new uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$return['URL'] = self::getUrl($accountName, $return['Secret'], $issuer);
$return['QR'] = self::generateQrCode($return['URL']);
// WARNING QR returns null if not available
}
- Read upRead up
- Exclude checks
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
Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
Open
if (Authenticatron::checkCode($_POST['secondfactor_code'], $secret)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
if (!empty($_POST['secondfactor_code'])) {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
Open
} else {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 16 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
}
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
Open
} else {
- Exclude checks
Line indented incorrectly; expected 8 spaces, found 12 Open
Open
if (
- Exclude checks