public function diff(Period $period)
{
if (!$this->overlaps($period)) {
throw new LogicException('Both Period objects should overlaps');
}
$res = [static::createFromDatepoints($this->startDate, $period->getStartDate()), static::createFromDatepoints($this->endDate, $period->getEndDate())];
$filter = function (Period $period) {
return $period->getStartDate() != $period->getEndDate();
};
return array_values(array_filter($res, $filter));
}