/home/techb158/immovalet.com/platform/plugins/analytics/src
Edit: /home/techb158/immovalet.com/platform/plugins/analytics/src/Period.php (2009B)
$endDate) {
throw InvalidPeriod::startDateCannotBeAfterEndDate($startDate, $endDate);
}
$this->startDate = $startDate;
$this->endDate = $endDate;
}
/**
* @param DateTimeInterface $startDate
* @param DateTimeInterface $endDate
* @return static
* @throws InvalidPeriod
*/
public static function create(DateTimeInterface $startDate, DateTimeInterface $endDate): self
{
return new static($startDate, $endDate);
}
/**
* @param int $numberOfDays
* @return static
* @throws InvalidPeriod
*/
public static function days(int $numberOfDays): self
{
$endDate = today();
$startDate = today()->subDays($numberOfDays)->startOfDay();
return new static($startDate, $endDate);
}
/**
* @param int $numberOfMonths
* @return static
* @throws InvalidPeriod
*/
public static function months(int $numberOfMonths): self
{
$endDate = today();
$startDate = today()->subMonths($numberOfMonths)->startOfDay();
return new static($startDate, $endDate);
}
/**
* @param int $numberOfYears
* @return static
* @throws InvalidPeriod
*/
public static function years(int $numberOfYears): self
{
$endDate = today();
$startDate = today()->subYears($numberOfYears)->startOfDay();
return new static($startDate, $endDate);
}
}