private function timeElementsAreValid($hours, $minutes, $seconds): bool
    {
        $exception = new \InvalidArgumentException(
            \sprintf('Invalid time "%02d:%02d:%02d".', $hours, $minutes, $seconds)
        );

        if ((int)\sprintf('%d%02d%02d', $hours, $minutes, $seconds) > 240000) {
            throw $exception;
        }
        if ($hours < 0 || $minutes < 0 || $seconds < 0) {
            throw $exception;
        }
        if ($hours <= 24 && $minutes <= 59 && $seconds <= 59) {
            return true;
        }

        throw $exception;
    }
private function timeElementsAreValid($hours, $minutes, $seconds): bool
    {
        $exception = new \InvalidArgumentException(
            \sprintf('Invalid time "%02d:%02d:%02d".', $hours, $minutes, $seconds)
        );

        if ((int)\sprintf('%d%02d%02d', $hours, $minutes, $seconds) > 240000) {
            throw $exception;
        }
        if ($hours < 0 || $minutes < 0 || $seconds < 0) {
            throw $exception;
        }
        if ($hours <= 24 && $minutes <= 59 && $seconds <= 59) {
            return true;
        }

        throw $exception;
    }
private function timeElementsAreValid ( $ hours , $ minutes , $ seconds ) : bool { $ exception = new \ InvalidArgumentException ( \ sprintf ( 'Invalid time "%02d:%02d:%02d".' , $ hours , $ minutes , $ seconds ) ) ; if ( ( int ) \ sprintf ( '%d%02d%02d' , $ hours , $ minutes , $ seconds ) > 240000 ) { throw $ exception ; } if ( $ hours < 0 || $ minutes < 0 || $ seconds < 0 ) { throw $ exception ; } if ( $ hours <= 24 && $ minutes <= 59 && $ seconds <= 59 ) { return true ; } throw $ exception ; }
Check if the time elements are valid.

@param integer $hours The hours.
@param integer $minutes The minutes.
@param integer $seconds The seconds.
@return boolean
@throws \InvalidArgumentException If the elements are not valid.
Check if the time elements are valid .