Doctrineum/DateInterval/DateInterval.php
Showing 2 of 2 total issues
Function intervalToSeconds
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function intervalToSeconds(\DateInterval $interval): string { $seconds = $interval->s; if ($interval->i > 0) { $seconds += $interval->i * self::SECONDS_MINUTE;
- Read upRead up
The method intervalToSeconds uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else { // integer overflow // fallback with Boston Math calculation (result is in string) $seconds = bcadd($seconds, bcmul($interval->y, self::SECONDS_YEAR)); }
- Read upRead up
- Exclude checks