chore: code cleanup
This commit is contained in:
1 parent
1a3640b15c
commit
5a01054b0e
65 files changed
+1046
-795
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Config;
|
||||
|
||||
/**
|
||||
* How far ahead a booking may be made.
|
||||
*
|
||||
* Measured from **today**, not from the day being booked: a cap relative to the chosen start date
|
||||
* can be pushed out simply by starting later, which is exactly what the previous
|
||||
* BookingSeries::MAX_MONTHS rule allowed (a series starting in six months could run to month
|
||||
* nine). It governs single bookings and series alike, which is why it lives here rather than on
|
||||
* BookingSeries.
|
||||
*
|
||||
* ROLE_ADMIN is exempt -- see BookingRequest::$unlimitedHorizon.
|
||||
*/
|
||||
final class BookingHorizon
|
||||
{
|
||||
public const MONTHS = 3;
|
||||
|
||||
/**
|
||||
* The last day that may still be booked. Inclusive.
|
||||
*/
|
||||
public static function latest(?\DateTimeImmutable $today = null): \DateTimeImmutable
|
||||
{
|
||||
return ($today ?? new \DateTimeImmutable('today'))
|
||||
->setTime(0, 0)
|
||||
->modify(\sprintf('+%d months', self::MONTHS));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user