Function intervalToSeconds
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public static function intervalToSeconds(\DateInterval $interval): string
{
$seconds = $interval->s;
if ($interval->i > 0) {
$seconds += $interval->i * self::SECONDS_MINUTE;
The method intervalToSeconds uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$seconds = bcadd($seconds, bcmul($interval->y, self::SECONDS_YEAR));
}
Avoid using static access to class '\Doctrine\DBAL\Types\ConversionException' in method 'convertToPHPValue'.
throw ConversionException::conversionFailedFormat(
$value,
$this->getName(),
'^\\d+$'
);
Avoid using static access to class '\Doctrineum\DateInterval\DateInterval' in method 'convertToPHPValue'.
return DateInterval::fromSeconds($value);
Avoid unused parameters such as '$sqlWalker'.
public function getSql(SqlWalker $sqlWalker): string
Avoid using static access to class '\Doctrineum\DateInterval\DateInterval' in method 'convertToDatabaseValue'.
: DateInterval::intervalToSeconds($value);
Avoid using static access to class '\Doctrineum\DateInterval\DateInterval' in method 'getSql'.
return DateInterval::intervalToSeconds(new DateInterval($this->intervalSpec->value));
Avoid unused parameters such as '$platform'.
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
Avoid unused parameters such as '$platform'.
public function convertToPHPValue($value, AbstractPlatform $platform): ?DateInterval