gdbots/common-php

View on GitHub
src/Common/Util/DateUtils.php

Summary

Maintainability
A
0 mins
Test Coverage

The method isValidTimestamp has a boolean flag argument $allowNegative, which is a certain sign of a Single Responsibility Principle violation.
Open

    public static function isValidTimestamp($timestamp, $allowNegative = false)
Severity: Minor
Found in src/Common/Util/DateUtils.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Avoid excessively long variable names like $crazyInsaneRegexThatSomehowDetectsIso8601. Keep variable name length under 20.
Open

        $crazyInsaneRegexThatSomehowDetectsIso8601 = '/^([\+-]?\d{4}(?!\d{2}\b))'
Severity: Minor
Found in src/Common/Util/DateUtils.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

There are no issues that match your filters.

Category
Status