42 lines
849 B
PHP
42 lines
849 B
PHP
<?php
|
|
|
|
namespace App\Model;
|
|
|
|
use Carbon\CarbonPeriod;
|
|
|
|
class TimelineFilterDto extends AssignmentFilterDto
|
|
{
|
|
protected bool $includePast = true;
|
|
protected ?CarbonPeriod $_period = null;
|
|
|
|
public function getDateFrom(): ?\DateTimeImmutable
|
|
{
|
|
if (null === $this->dateFrom) {
|
|
return $this->_period->first()->toDateTimeImmutable();
|
|
}
|
|
|
|
return $this->dateFrom;
|
|
}
|
|
|
|
public function getDateTo(): ?\DateTimeImmutable
|
|
{
|
|
if (null === $this->dateTo) {
|
|
return $this->_period->last()->toDateTimeImmutable();
|
|
}
|
|
|
|
return $this->dateTo;
|
|
}
|
|
|
|
public function getPeriod(): ?CarbonPeriod
|
|
{
|
|
return $this->_period;
|
|
}
|
|
|
|
public function setPeriod(?CarbonPeriod $_period): static
|
|
{
|
|
$this->_period = $_period;
|
|
|
|
return $this;
|
|
}
|
|
}
|